Skip to content

Commit

Permalink
Merge branch '2.7.x' into 3.2.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	mica-core/src/main/java/net/dreamlu/mica/core/graalvm/NativeUtil.java
  • Loading branch information
ChunMengLu committed Dec 5, 2024
2 parents 3a8736e + e5f9080 commit d597610
Show file tree
Hide file tree
Showing 27 changed files with 1,528 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nbdist/
.nb-gradle/

### maven ###
.flattened-pom.xml
target/
*.war
*.ear
Expand Down
66 changes: 66 additions & 0 deletions mica-activerecord/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mica-activerecord</artifactId>
<name>${project.artifactId}</name>
<url>https://www.dreamlu.net</url>

<parent>
<groupId>net.dreamlu</groupId>
<artifactId>mica</artifactId>
<version>${revision}</version>
</parent>

<dependencies>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-core</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>activerecord</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-auto</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.jf</include>
</includes>
</resource>
</resources>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ public ActiveRecordPlugin activeRecordPlugin(IDataSourceProvider dataSourceProvi
ResourceLoader resourceLoader,
MicaActiveRecordProperties properties,
ObjectProvider<ActiveRecordPluginCustomizer> customizerObjectProvider) {
String modelPackage = properties.getModelPackage();
Assert.hasText(modelPackage, "mica.activerecord.model-package is blank.");
ActiveRecordPlugin arp = new ActiveRecordPlugin(dataSourceProvider);
arp.setDialect(properties.getDialect().getDialect());
arp.setTransactionLevel(properties.getTransactionLevel().getLevel());
Expand All @@ -161,6 +159,8 @@ public ActiveRecordPlugin activeRecordPlugin(IDataSourceProvider dataSourceProvi
}
// 扫描和添加表映射
if (properties.isAutoTableScan()) {
String modelPackage = properties.getModelPackage();
Assert.hasText(modelPackage, "mica.activerecord.model-package is blank.");
scanTable(arp, environment, resourceLoader, modelPackage);
}
// arp 自定义配置 bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class MicaActiveRecordProperties {
*/
private String modelPackage;
/**
* 自定表扫描
* 自动表扫描
*/
private boolean autoTableScan = true;
/**
Expand Down
37 changes: 37 additions & 0 deletions mica-bom/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mica-bom</artifactId>
<name>${project.artifactId}</name>
<url>https://www.dreamlu.net</url>
<packaging>pom</packaging>

<parent>
<groupId>net.dreamlu</groupId>
<artifactId>mica</artifactId>
<version>${revision}</version>
</parent>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>oss</flattenMode>
<pomElements>
<dependencyManagement>expand</dependencyManagement>
<pluginManagement>remove</pluginManagement>
<dependencies>remove</dependencies>
<properties>remove</properties>
<repositories>remove</repositories>
</pomElements>
</configuration>
</plugin>
</plugins>
</build>

</project>
46 changes: 46 additions & 0 deletions mica-caffeine/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mica-caffeine</artifactId>
<name>${project.artifactId}</name>
<url>https://www.dreamlu.net</url>

<parent>
<groupId>net.dreamlu</groupId>
<artifactId>mica</artifactId>
<version>${revision}</version>
</parent>

<dependencies>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-core</artifactId>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-auto</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
48 changes: 48 additions & 0 deletions mica-captcha/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mica-captcha</artifactId>
<name>${project.artifactId}</name>
<url>https://www.dreamlu.net</url>

<parent>
<groupId>net.dreamlu</groupId>
<artifactId>mica</artifactId>
<version>${revision}</version>
</parent>

<dependencies>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-auto</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
101 changes: 101 additions & 0 deletions mica-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mica-core</artifactId>
<name>${project.artifactId}</name>
<url>https://www.dreamlu.net</url>

<parent>
<groupId>net.dreamlu</groupId>
<artifactId>mica</artifactId>
<version>${revision}</version>
</parent>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-auto</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-generated-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/net/dreamlu/mica/core</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-version-file</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/net/dreamlu/mica/core</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/mica/java/net/dreamlu/mica/core</directory>
<filtering>true</filtering>
<includes>
<include>Mica.java</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package net.dreamlu.mica.core.graalvm;

import org.springframework.util.ClassUtils;

/**
* Native 工具
*
* <p>
* 参考: NativeDetector 和 NativeListener
* </p>
*
* @author L.cm
*/
public class NativeUtil {
public static final String GENERATED_CLASS = "org.springframework.aot.StaticSpringFactories";

public static final boolean GENERATED_CLASS_PRESENT = ClassUtils.isPresent(GENERATED_CLASS, null);

/**
* Holds the string that is the name of the system property providing information about the
* context in which code is currently executing.
*/
public static final String PROPERTY_IMAGE_CODE_KEY = "org.graalvm.nativeimage.imagecode";

/**
* See https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/ImageInfo.java
*/
private static final boolean IS_IMAGE_CODE = (System.getProperty(PROPERTY_IMAGE_CODE_KEY) != null);

/**
* Returns {@code true} if invoked in the context of image building or during image runtime, else {@code false}.
*
* @return boolean
*/
public static boolean inNativeImage() {
return IS_IMAGE_CODE || GENERATED_CLASS_PRESENT;
}

}
Loading

0 comments on commit d597610

Please sign in to comment.