This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git


The following commit(s) were added to refs/heads/master by this push:
     new cfe008951 Provides built-in GraalVM Reachability Metadata and 
nativeTest on Elasticjob Spring Boot Starter under Spring Boot 3.3.2 (#2417)
cfe008951 is described below

commit cfe00895155ccab7c588f55049339a19be874edf
Author: Ling Hengqian <[email protected]>
AuthorDate: Sun Aug 11 09:48:32 2024 +0800

    Provides built-in GraalVM Reachability Metadata and nativeTest on 
Elasticjob Spring Boot Starter under Spring Boot 3.3.2 (#2417)
---
 .github/workflows/graalvm.yml                      |   2 +-
 .../configuration/graalvm-native-image.cn.md       | 107 ++++++++++++++++++++-
 .../configuration/graalvm-native-image.en.md       | 107 ++++++++++++++++++++-
 pom.xml                                            |  20 +++-
 .../proxy-config.json                              |   2 +-
 .../reflect-config.json                            |  75 +++++++--------
 .../resource-config.json                           |  14 ++-
 spring/pom.xml                                     |   3 +-
 test/native/native-image-filter/extra-filter.json  |  10 +-
 test/native/pom.xml                                |  28 +++++-
 .../elasticjob/test/natived/TestMain.java          |  31 ++++++
 .../commons/controller/OneOffJobController.java    |  50 ++++++++++
 .../job/dataflow/SpringBootDataflowJob.java        |  62 ++++++++++++
 .../commons/job/simple/SpringBootSimpleJob.java    |  51 ++++++++++
 .../repository/SpringBootFooRepository.java        |  74 ++++++++++++++
 .../test/natived/{ => it/staticd}/JavaTest.java    |   4 +-
 .../test/natived/it/staticd/SpirngBootTest.java    | 106 ++++++++++++++++++++
 test/native/src/test/resources/application.yml     |  52 ++++++++++
 18 files changed, 731 insertions(+), 67 deletions(-)

diff --git a/.github/workflows/graalvm.yml b/.github/workflows/graalvm.yml
index 1216b9307..b396737ff 100644
--- a/.github/workflows/graalvm.yml
+++ b/.github/workflows/graalvm.yml
@@ -45,4 +45,4 @@ jobs:
           native-image-job-reports: 'true'
       - name: Run nativeTest with GraalVM CE for ${{ matrix.java-version }}
         continue-on-error: true
-        run: ./mvnw -PnativeTestInElasticJob -T1C -B -e clean test
+        run: ./mvnw -PnativeTestInElasticJob -T1C -B -e 
-Dspring-boot-dependencies.version=3.3.2 clean test
diff --git a/docs/content/user-manual/configuration/graalvm-native-image.cn.md 
b/docs/content/user-manual/configuration/graalvm-native-image.cn.md
index e0e65f97a..79ca6f43b 100644
--- a/docs/content/user-manual/configuration/graalvm-native-image.cn.md
+++ b/docs/content/user-manual/configuration/graalvm-native-image.cn.md
@@ -91,6 +91,107 @@ graalvmNative {
 }
 ```
 
+## 使用 ElasticJob 的 Spring Boot Starter
+
+### Maven 生态
+
+使用者需要主动使用 GraalVM Reachability Metadata 中央仓库。
+如下配置可供参考,以配置项目额外的 Maven Profiles,以 GraalVM Native Build Tools 的文档为准。
+
+```xml
+<project>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-spring-boot-starter</artifactId>
+            <version>${elasticjob.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+            <version>3.3.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <version>3.3.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.graalvm.buildtools</groupId>
+                <artifactId>native-maven-plugin</artifactId>
+                <version>0.10.2</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>build-native</id>
+                        <goals>
+                            <goal>compile-no-fork</goal>
+                        </goals>
+                        <phase>package</phase>
+                    </execution>
+                    <execution>
+                        <id>test-native</id>
+                        <goals>
+                            <goal>test</goal>
+                        </goals>
+                        <phase>test</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>3.3.2</version>
+                <executions>
+                    <execution>
+                        <id>process-test-aot</id>
+                        <goals>
+                            <goal>process-test-aot</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+```
+
+### Gradle 生态
+
+使用者需要主动使用 GraalVM Reachability Metadata 中央仓库。
+如下配置可供参考,以配置项目额外的 Gradle Tasks,以 GraalVM Native Build Tools 的文档为准。
+由于 https://github.com/gradle/gradle/issues/17559 的限制,用户需要通过 Maven 依赖的形式引入 
Metadata Repository 的 JSON 文件。
+参考 https://github.com/graalvm/native-build-tools/issues/572 。
+
+```groovy
+plugins {
+   id 'org.springframework.boot' version '3.3.2'
+   id 'io.spring.dependency-management' version '1.1.6'
+   id 'org.graalvm.buildtools.native' version '0.10.2'
+}
+
+dependencies {
+   implementation 'org.springframework.boot:spring-boot-starter-jdbc'
+   implementation 'org.springframework.boot:spring-boot-starter-web'
+   implementation 
'org.apache.shardingsphere.elasticjob:elasticjob-spring-boot-starter:${elasticjob.version}'
+   implementation(group: 'org.graalvm.buildtools', name: 
'graalvm-reachability-metadata', version: '0.10.2', classifier: 'repository', 
ext: 'zip')
+}
+
+graalvmNative {
+   metadataRepository {
+        enabled.set(false)
+   }
+}
+```
+
+
 ## 对于 sbt 等不被 GraalVM Native Build Tools 支持的构建工具
 
 此类需求需要在 https://github.com/graalvm/native-build-tools 打开额外的 issue 并提供对应构建工具的 
Plugin 实现。
@@ -128,8 +229,6 @@ public class ExampleUtils {
 
 4. ElasticJob 的 Spring 命名空间集成模块 
`org.apache.shardingsphere.elasticjob:elasticjob-spring-namespace` 尚未在 GraalVM 
Native Image 下可用。
 
-5. ElasticJob 的 Spring Boot Starter 集成模块 
`org.apache.shardingsphere.elasticjob:elasticjob-spring-boot-starter` 尚未在 
GraalVM Native Image 下可用。
-
 ## 贡献 GraalVM Reachability Metadata
 
 ElasticJob 对在 GraalVM Native Image 下的可用性的验证,是通过 GraalVM Native Build Tools 的 
Maven Plugin 子项目来完成的。
@@ -157,7 +256,7 @@ sudo apt-get install build-essential zlib1g-dev -y
 
 git clone [email protected]:apache/shardingsphere-elasticjob.git
 cd ./shardingsphere-elasticjob/
-./mvnw -PnativeTestInElasticJob -T1C -e clean test
+./mvnw -PnativeTestInElasticJob -T1C -e 
-Dspring-boot-dependencies.version=3.3.2 clean test
 ```
 
 当贡献者发现缺少与 ElasticJob 无关的第三方库的 GraalVM Reachability Metadata 时,应当在
@@ -186,5 +285,5 @@ ElasticJob 定义了 `generateMetadata` 的 Maven Profile 用于在 
GraalVM JIT
 ```bash
 git clone [email protected]:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C clean test 
native:metadata-copy
+./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C 
-Dspring-boot-dependencies.version=3.3.2 clean test native:metadata-copy
 ```
diff --git a/docs/content/user-manual/configuration/graalvm-native-image.en.md 
b/docs/content/user-manual/configuration/graalvm-native-image.en.md
index 513a58a85..fb86d608e 100644
--- a/docs/content/user-manual/configuration/graalvm-native-image.en.md
+++ b/docs/content/user-manual/configuration/graalvm-native-image.en.md
@@ -93,6 +93,107 @@ graalvmNative {
 }
 ```
 
+## Using ElasticJob's Spring Boot Starter
+
+### Maven Ecosystem
+
+Users need to actively use the GraalVM Reachability Metadata Central 
Repository.
+The following configuration is for reference. 
+To configure additional Maven Profiles for the project, refer to the 
documentation of GraalVM Native Build Tools.
+
+```xml
+<project>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere.elasticjob</groupId>
+            <artifactId>elasticjob-spring-boot-starter</artifactId>
+            <version>${elasticjob.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+            <version>3.3.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <version>3.3.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.graalvm.buildtools</groupId>
+                <artifactId>native-maven-plugin</artifactId>
+                <version>0.10.2</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>build-native</id>
+                        <goals>
+                            <goal>compile-no-fork</goal>
+                        </goals>
+                        <phase>package</phase>
+                    </execution>
+                    <execution>
+                        <id>test-native</id>
+                        <goals>
+                            <goal>test</goal>
+                        </goals>
+                        <phase>test</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>3.3.2</version>
+                <executions>
+                    <execution>
+                        <id>process-test-aot</id>
+                        <goals>
+                            <goal>process-test-aot</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+```
+
+### Gradle Ecosystem
+
+Users need to actively use the GraalVM Reachability Metadata Central 
Repository.
+The following configuration is for reference. To configure additional Gradle 
Tasks for the project, refer to the documentation of GraalVM Native Build Tools.
+Due to the limitations of https://github.com/gradle/gradle/issues/17559, users 
need to introduce the Metadata Repository JSON file in the form of Maven 
dependencies.
+Refer to https://github.com/graalvm/native-build-tools/issues/572 .
+
+```groovy
+plugins {
+   id 'org.springframework.boot' version '3.3.2'
+   id 'io.spring.dependency-management' version '1.1.6'
+   id 'org.graalvm.buildtools.native' version '0.10.2'
+}
+
+dependencies {
+   implementation 'org.springframework.boot:spring-boot-starter-jdbc'
+   implementation 'org.springframework.boot:spring-boot-starter-web'
+   implementation 
'org.apache.shardingsphere.elasticjob:elasticjob-spring-boot-starter:${elasticjob.version}'
+   implementation(group: 'org.graalvm.buildtools', name: 
'graalvm-reachability-metadata', version: '0.10.2', classifier: 'repository', 
ext: 'zip')
+}
+
+graalvmNative {
+   metadataRepository {
+        enabled.set(false)
+   }
+}
+```
+
 ## For build tools such as sbt that are not supported by GraalVM Native Build 
Tools
 
 Such requirements require opening additional issues at 
https://github.com/graalvm/native-build-tools and providing plugin 
implementations for the corresponding build tools.
@@ -130,8 +231,6 @@ public class ExampleUtils {
 
 4. The Spring namespace integration module 
`org.apache.shardingsphere.elasticjob:elasticjob-spring-namespace` of 
ElasticJob is not yet available under GraalVM Native Image.
 
-5. The Spring Boot Starter integration module 
`org.apache.shardingsphere.elasticjob:elasticjob-spring-boot-starter` for 
ElasticJob is not yet available under GraalVM Native Image.
-
 ## Contribute GraalVM Reachability Metadata
 
 ElasticJob's usability verification under GraalVM Native Image is done by the 
Maven Plugin subproject of GraalVM Native Build Tools.
@@ -160,7 +259,7 @@ sudo apt-get install build-essential zlib1g-dev -y
 
 git clone [email protected]:apache/shardingsphere-elasticjob.git
 cd ./shardingsphere-elasticjob/
-./mvnw -PnativeTestInElasticJob -T1C -e clean test
+./mvnw -PnativeTestInElasticJob -T1C -e 
-Dspring-boot-dependencies.version=3.3.2 clean test
 ```
 
 When contributors find that GraalVM Reachability Metadata for third-party 
libraries not related to ElasticJob is missing, 
@@ -190,5 +289,5 @@ contributors should place it in the classpath of the 
shardingsphere-test-native
 ```bash
 git clone [email protected]:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C clean test 
native:metadata-copy
+./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C 
-Dspring-boot-dependencies.version=3.3.2 clean test native:metadata-copy
 ```
diff --git a/pom.xml b/pom.xml
index 15a3aa9ca..4bc966d9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -93,6 +93,8 @@
         <h2.version>2.2.224</h2.version>
         <hikari-cp.version>4.0.3</hikari-cp.version>
         
+        
<spring-boot-dependencies.version>2.7.18</spring-boot-dependencies.version>
+        
         <!-- Compile plugin versions -->
         <maven-enforcer-plugin.version>3.2.1</maven-enforcer-plugin.version>
         <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
@@ -755,13 +757,16 @@
             <activation>
                 <jdk>[11,)</jdk>
             </activation>
+            <properties>
+                <maven.compiler.release>8</maven.compiler.release>
+            </properties>
             <build>
                 <pluginManagement>
                     <plugins>
                         <plugin>
                             <artifactId>maven-surefire-plugin</artifactId>
                             <configuration>
-                                <argLine>@{argLine} --add-opens 
java.base/java.lang=ALL-UNNAMED --add-opens 
java.base/java.lang.reflect=ALL-UNNAMED --add-opens 
java.base/java.util=ALL-UNNAMED</argLine>
+                                <argLine>@{argLine} --add-opens 
java.base/java.lang.reflect=ALL-UNNAMED</argLine>
                             </configuration>
                         </plugin>
                     </plugins>
@@ -1015,6 +1020,19 @@
                                 </execution>
                             </executions>
                         </plugin>
+                        <plugin>
+                            <groupId>org.springframework.boot</groupId>
+                            <artifactId>spring-boot-maven-plugin</artifactId>
+                            
<version>${spring-boot-dependencies.version}</version>
+                            <executions>
+                                <execution>
+                                    <id>process-test-aot</id>
+                                    <goals>
+                                        <goal>process-test-aot</goal>
+                                    </goals>
+                                </execution>
+                            </executions>
+                        </plugin>
                     </plugins>
                 </pluginManagement>
             </build>
diff --git 
a/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/proxy-config.json
 
b/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/proxy-config.json
index fd2d4325f..25cf82054 100644
--- 
a/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/proxy-config.json
+++ 
b/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/proxy-config.json
@@ -1,6 +1,6 @@
 [
   {
-    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.tracing.rdb.storage.converter.RDBTracingStorageConfigurationConverter"},
+    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.tracing.ElasticJobTracingConfiguration$RDBTracingConfiguration"},
     "interfaces":["java.sql.Connection"]
   }
 ]
\ No newline at end of file
diff --git 
a/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/reflect-config.json
 
b/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/reflect-config.json
index b934e8520..5dfc6c97c 100644
--- 
a/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/reflect-config.json
+++ 
b/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/reflect-config.json
@@ -4,9 +4,8 @@
   "name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
-  "name":"java.util.Properties",
-  "methods":[{"name":"<init>","parameterTypes":[] }]
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.tracing.ElasticJobTracingConfiguration$RDBTracingConfiguration"},
+  "name":"[Ljava.sql.Statement;"
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.ElasticJobExecutor"},
@@ -23,6 +22,11 @@
   "name":"java.util.Properties",
   "methods":[{"name":"<init>","parameterTypes":[] }]
 },
+{
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener"},
+  "name":"java.util.Properties",
+  "methods":[{"name":"<init>","parameterTypes":[] }]
+},
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ShardingListenerManager$ShardingTotalCountChangedJobListener"},
   "name":"java.util.Properties",
@@ -48,7 +52,7 @@
   "methods":[{"name":"<init>","parameterTypes":[] }]
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.ElasticJobExecutor"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
   "name":"org.apache.shardingsphere.elasticjob.http.executor.HttpJobExecutor"
 },
 {
@@ -59,21 +63,15 @@
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.threadpool.ExecutorServiceReloader"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.executor.threadpool.type.SingleThreadJobExecutorThreadPoolSizeProvider"
 },
-{
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.OneOffJobBootstrap"},
-  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO",
-  "queryAllPublicMethods":true
-},
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO",
-  "queryAllPublicMethods":true,
-  "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, 
{"name":"setProps","parameterTypes":["java.util.Properties"] }]
+  "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }]
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.ElasticJobExecutor"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO",
-  "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, 
{"name":"setProps","parameterTypes":["java.util.Properties"] }]
+  "methods":[{"name":"setProps","parameterTypes":["java.util.Properties"] }]
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.infra.yaml.YamlEngine"},
@@ -98,15 +96,20 @@
   "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, 
{"name":"setProps","parameterTypes":["java.util.Properties"] }]
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobScheduler"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO",
-  "queryAllPublicMethods":true
+  "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, 
{"name":"setProps","parameterTypes":["java.util.Properties"] }]
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ShardingListenerManager$ShardingTotalCountChangedJobListener"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO",
   "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, 
{"name":"setProps","parameterTypes":["java.util.Properties"] }]
 },
+{
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
+  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO",
+  "queryAllPublicMethods":true
+},
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJOBeanInfo"
@@ -115,22 +118,20 @@
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJOCustomizer"
 },
-{
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.OneOffJobBootstrap"},
-  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobShutdownHookPlugin",
-  "queryAllPublicMethods":true
-},
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
-  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobShutdownHookPlugin",
-  "queryAllPublicMethods":true
+  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobShutdownHookPlugin"
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobScheduler"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobShutdownHookPlugin",
-  "queryAllPublicMethods":true,
   "methods":[{"name":"<init>","parameterTypes":[] }, 
{"name":"setCleanShutdown","parameterTypes":["boolean"] }]
 },
+{
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
+  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobShutdownHookPlugin",
+  "queryAllPublicMethods":true
+},
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobShutdownHookPluginBeanInfo"
@@ -139,15 +140,9 @@
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobShutdownHookPluginCustomizer"
 },
-{
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.OneOffJobBootstrap"},
-  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance",
-  "queryAllPublicMethods":true
-},
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
-  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance",
-  "queryAllPublicMethods":true
+  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance"
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.instance.InstanceNode"},
@@ -156,18 +151,10 @@
   "methods":[{"name":"getJobInstanceId","parameterTypes":[] }, 
{"name":"getLabels","parameterTypes":[] }, 
{"name":"getServerIp","parameterTypes":[] }]
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.instance.InstanceService"},
-  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance"
-},
-{
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobScheduler"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance",
   "queryAllPublicMethods":true
 },
-{
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.setup.SetUpFacade"},
-  
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance"
-},
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
   
"name":"org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstanceBeanInfo"
@@ -191,7 +178,7 @@
   
"name":"org.apache.shardingsphere.elasticjob.reg.zookeeper.exception.ZookeeperCuratorIgnoredExceptionProvider"
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.ElasticJobExecutor"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
   
"name":"org.apache.shardingsphere.elasticjob.script.executor.ScriptJobExecutor"
 },
 {
@@ -199,17 +186,21 @@
   
"name":"org.apache.shardingsphere.elasticjob.simple.executor.SimpleJobExecutor"
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobTracingEventBus"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
   
"name":"org.apache.shardingsphere.elasticjob.spi.tracing.listener.TracingListener",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobTracingEventBus"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.internal.setup.JobClassNameProviderFactory"},
+  
"name":"org.apache.shardingsphere.elasticjob.spring.core.setup.SpringProxyJobClassNameProvider"
+},
+{
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
   
"name":"org.apache.shardingsphere.elasticjob.tracing.rdb.listener.RDBTracingListener",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobTracingEventBus"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
   
"name":"org.apache.shardingsphere.elasticjob.tracing.rdb.listener.RDBTracingListenerFactory"
 },
 {
diff --git 
a/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/resource-config.json
 
b/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/resource-config.json
index 101e57e2f..07292ac06 100644
--- 
a/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/resource-config.json
+++ 
b/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/generated-reachability-metadata/resource-config.json
@@ -1,6 +1,9 @@
 {
   "resources":{
   "includes":[{
+    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.tracing.ElasticJobTracingConfiguration$RDBTracingConfiguration"},
+    "pattern":"\\QMETA-INF/services/java.sql.Driver\\E"
+  }, {
     
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.threadpool.ExecutorServiceReloader"},
     
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.kernel.executor.threadpool.JobExecutorThreadPoolSizeProvider\\E"
   }, {
@@ -10,16 +13,16 @@
     
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.reg.exception.RegExceptionHandler"},
     
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.reg.exception.IgnoredExceptionProvider\\E"
   }, {
-    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
+    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
     
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.spi.executor.error.handler.JobErrorHandler\\E"
   }, {
     
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.item.JobItemExecutorFactory"},
     
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.spi.executor.item.type.ClassedJobItemExecutor\\E"
   }, {
-    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.executor.ElasticJobExecutor"},
+    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
     
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.spi.executor.item.type.TypedJobItemExecutor\\E"
   }, {
-    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobTracingEventBus"},
+    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
     
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.spi.tracing.listener.TracingListenerFactory\\E"
   }, {
     
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverterFactory"},
@@ -34,7 +37,10 @@
     
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.tracing.rdb.storage.sql.SQLPropertiesFactory"},
     "pattern":"\\QMETA-INF/sql/H2.properties\\E"
   }, {
-    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.bootstrap.type.ScheduleJobBootstrap"},
+    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.tracing.ElasticJobTracingConfiguration$RDBTracingConfiguration"},
+    "pattern":"\\Qorg/h2/util/data.zip\\E"
+  }, {
+    
"condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.spring.boot.job.ElasticJobBootstrapConfiguration"},
     "pattern":"\\Qorg/quartz/core/quartz-build.properties\\E"
   }]},
   "bundles":[]
diff --git a/spring/pom.xml b/spring/pom.xml
index 619845828..1ffaaa303 100644
--- a/spring/pom.xml
+++ b/spring/pom.xml
@@ -34,7 +34,6 @@
     </modules>
     
     <properties>
-        <springboot.version>2.7.18</springboot.version>
         <aspectj.version>1.9.22.1</aspectj.version>
     </properties>
     
@@ -43,7 +42,7 @@
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-dependencies</artifactId>
-                <version>${springboot.version}</version>
+                <version>${spring-boot-dependencies.version}</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
diff --git a/test/native/native-image-filter/extra-filter.json 
b/test/native/native-image-filter/extra-filter.json
index 9e706a39d..dacbc3468 100644
--- a/test/native/native-image-filter/extra-filter.json
+++ b/test/native/native-image-filter/extra-filter.json
@@ -2,13 +2,13 @@
   "rules": [
     {"includeClasses": "**"},
 
-    {"excludeClasses": "com.google.common.util.concurrent.**"},
-    {"excludeClasses": "com.zaxxer.hikari.**"},
+    {"excludeClasses": "com.**"},
     {"excludeClasses": "java.**"},
     {"includeClasses": "java.util.Properties"},
-    {"excludeClasses": "org.apache.zookeeper.**"},
-    {"excludeClasses": "org.quartz.**"},
-    {"excludeClasses": "sun.misc.**"},
+    {"excludeClasses": "javax.**"},
+    {"excludeClasses": "org.**"},
+    {"includeClasses": "org.apache.shardingsphere.elasticjob.**"},
+    {"excludeClasses": "sun.**"},
 
     {"excludeClasses": "org.apache.shardingsphere.elasticjob.test.natived.**"}
   ],
diff --git a/test/native/pom.xml b/test/native/pom.xml
index 459222a52..00cca3bdd 100644
--- a/test/native/pom.xml
+++ b/test/native/pom.xml
@@ -28,12 +28,15 @@
     
     <properties>
         <maven.deploy.skip>true</maven.deploy.skip>
+        <!--TODO Unfortunately, ElasticJob is still using Slf4j API 1.7.36 -->
+        <slf4j.version>2.0.13</slf4j.version>
+        <logback.version>1.5.6</logback.version>
     </properties>
     
     <dependencies>
         <dependency>
             <groupId>org.apache.shardingsphere.elasticjob</groupId>
-            <artifactId>elasticjob-bootstrap</artifactId>
+            <artifactId>elasticjob-spring-boot-starter</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
@@ -53,6 +56,24 @@
             <artifactId>curator-test</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+            <version>${spring-boot-dependencies.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <version>${spring-boot-dependencies.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <version>${spring-boot-dependencies.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     
     <build>
@@ -62,6 +83,11 @@
                 <artifactId>native-maven-plugin</artifactId>
                 <version>${native-maven-plugin.version}</version>
             </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot-dependencies.version}</version>
+            </plugin>
         </plugins>
     </build>
 </project>
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/TestMain.java
 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/TestMain.java
new file mode 100644
index 000000000..b70478796
--- /dev/null
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/TestMain.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.test.natived;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class TestMain {
+    
+    // CHECKSTYLE:OFF
+    public static void main(final String[] args) {
+        // CHECKSTYLE:ON
+        SpringApplication.run(TestMain.class, args);
+    }
+}
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/controller/OneOffJobController.java
 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/controller/OneOffJobController.java
new file mode 100644
index 000000000..64db2f93a
--- /dev/null
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/controller/OneOffJobController.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.test.natived.commons.controller;
+
+import org.apache.shardingsphere.elasticjob.bootstrap.type.OneOffJobBootstrap;
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Objects;
+
+@RestController
+public class OneOffJobController {
+    
+    @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
+    @Autowired
+    @Qualifier("manualScriptJobBean")
+    private ObjectProvider<OneOffJobBootstrap> manualScriptJobProvider;
+    
+    /**
+     * Execute manual script job.
+     *
+     * @return a String
+     */
+    @GetMapping("/execute/manualScriptJob")
+    public String executeManualScriptJob() {
+        OneOffJobBootstrap manualScriptJob = 
manualScriptJobProvider.getIfAvailable();
+        Objects.requireNonNull(manualScriptJob);
+        manualScriptJob.execute();
+        manualScriptJob.shutdown();
+        return "{\"msg\":\"OK\"}";
+    }
+}
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/job/dataflow/SpringBootDataflowJob.java
 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/job/dataflow/SpringBootDataflowJob.java
new file mode 100644
index 000000000..992ca14dc
--- /dev/null
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/job/dataflow/SpringBootDataflowJob.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.test.natived.commons.job.dataflow;
+
+import org.apache.shardingsphere.elasticjob.dataflow.job.DataflowJob;
+import 
org.apache.shardingsphere.elasticjob.spi.executor.item.param.ShardingContext;
+import org.apache.shardingsphere.elasticjob.test.natived.commons.entity.Foo;
+import 
org.apache.shardingsphere.elasticjob.test.natived.commons.repository.SpringBootFooRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.lang.invoke.MethodHandles;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@SuppressWarnings("LoggingSimilarMessage")
+@Component
+public class SpringBootDataflowJob implements DataflowJob<Foo> {
+    
+    private final Logger logger = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+    
+    @Autowired
+    private SpringBootFooRepository springBootFooRepository;
+    
+    @Override
+    public List<Foo> fetchData(final ShardingContext shardingContext) {
+        logger.info("Item: {} | Time: {} | Thread: {} | {}",
+                shardingContext.getShardingItem(),
+                new SimpleDateFormat("HH:mm:ss").format(new Date()),
+                Thread.currentThread().getId(),
+                "DATAFLOW FETCH");
+        return 
springBootFooRepository.findTodoData(shardingContext.getShardingParameter(), 
10);
+    }
+    
+    @Override
+    public void processData(final ShardingContext shardingContext, final 
List<Foo> data) {
+        logger.info("Item: {} | Time: {} | Thread: {} | {}",
+                shardingContext.getShardingItem(),
+                new SimpleDateFormat("HH:mm:ss").format(new Date()),
+                Thread.currentThread().getId(),
+                "DATAFLOW PROCESS");
+        data.forEach(each -> 
springBootFooRepository.setCompleted(each.getId()));
+    }
+}
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/job/simple/SpringBootSimpleJob.java
 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/job/simple/SpringBootSimpleJob.java
new file mode 100644
index 000000000..1185636d2
--- /dev/null
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/job/simple/SpringBootSimpleJob.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.test.natived.commons.job.simple;
+
+import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
+import 
org.apache.shardingsphere.elasticjob.spi.executor.item.param.ShardingContext;
+import 
org.apache.shardingsphere.elasticjob.test.natived.commons.repository.SpringBootFooRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.lang.invoke.MethodHandles;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Component
+public class SpringBootSimpleJob implements SimpleJob {
+    
+    private final Logger logger = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+    
+    @Autowired
+    private SpringBootFooRepository springBootFooRepository;
+    
+    @Override
+    public void execute(final ShardingContext shardingContext) {
+        logger.info(
+                "Item: {} | Time: {} | Thread: {} | {}",
+                shardingContext.getShardingItem(),
+                new SimpleDateFormat("HH:mm:ss").format(new Date()),
+                Thread.currentThread().getId(),
+                "SIMPLE");
+        
springBootFooRepository.findTodoData(shardingContext.getShardingParameter(), 10)
+                .forEach(each -> 
springBootFooRepository.setCompleted(each.getId()));
+    }
+}
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/repository/SpringBootFooRepository.java
 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/repository/SpringBootFooRepository.java
new file mode 100644
index 000000000..cafe2bb02
--- /dev/null
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/commons/repository/SpringBootFooRepository.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.test.natived.commons.repository;
+
+import org.apache.shardingsphere.elasticjob.test.natived.commons.entity.Foo;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.LongStream;
+
+@Repository
+public class SpringBootFooRepository {
+    
+    private final Map<Long, Foo> data = new ConcurrentHashMap<>(300, 1);
+    
+    public SpringBootFooRepository() {
+        addData(0L, 100L, "Beijing");
+        addData(100L, 200L, "Shanghai");
+        addData(200L, 300L, "Guangzhou");
+    }
+    
+    private void addData(final long idFrom, final long idTo, final String 
location) {
+        LongStream.range(idFrom, idTo)
+                .forEachOrdered(i -> data.put(i, new Foo(i, location, 
Foo.Status.TODO)));
+    }
+    
+    /**
+     * Find todoData.
+     * @param location location
+     * @param limit limit
+     * @return An ordered collection, where the user has precise control over 
where in the list each element is inserted.
+     */
+    public List<Foo> findTodoData(final String location, final int limit) {
+        List<Foo> result = new ArrayList<>(limit);
+        int count = 0;
+        for (Map.Entry<Long, Foo> each : data.entrySet()) {
+            Foo foo = each.getValue();
+            if (foo.getLocation().equals(location) && foo.getStatus() == 
Foo.Status.TODO) {
+                result.add(foo);
+                count++;
+                if (count == limit) {
+                    break;
+                }
+            }
+        }
+        return result;
+    }
+    
+    /**
+     * Set completed.
+     * @param id id
+     */
+    public void setCompleted(final long id) {
+        data.get(id).setStatus(Foo.Status.COMPLETED);
+    }
+}
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/JavaTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/staticd/JavaTest.java
similarity index 98%
rename from 
test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/JavaTest.java
rename to 
test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/staticd/JavaTest.java
index 8b8212854..bb4e91163 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/JavaTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/staticd/JavaTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.elasticjob.test.natived;
+package org.apache.shardingsphere.elasticjob.test.natived.it.staticd;
 
 import com.zaxxer.hikari.HikariConfig;
 import com.zaxxer.hikari.HikariDataSource;
@@ -75,7 +75,7 @@ class JavaTest {
                         60 * 1000, 500, null,
                         new ExponentialBackoffRetry(500, 3, 500 * 3))) {
             client.start();
-            Awaitility.await().atMost(Duration.ofMillis(500 * 
60)).until(client::isConnected);
+            Awaitility.await().atMost(Duration.ofMillis(500 * 
60)).ignoreExceptions().until(client::isConnected);
         }
         regCenter = new ZookeeperRegistryCenter(new 
ZookeeperConfiguration(testingServer.getConnectString(), 
"elasticjob-test-native-java"));
         regCenter.init();
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/staticd/SpirngBootTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/staticd/SpirngBootTest.java
new file mode 100644
index 000000000..c07a635ea
--- /dev/null
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/staticd/SpirngBootTest.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.test.natived.it.staticd;
+
+import org.apache.curator.CuratorZookeeperClient;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.curator.test.InstanceSpec;
+import org.apache.curator.test.TestingServer;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledInNativeImage;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.DynamicPropertyRegistry;
+import org.springframework.test.context.DynamicPropertySource;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
+import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@EnabledInNativeImage
+class SpirngBootTest {
+    
+    private static TestingServer testingServer;
+    
+    private MockMvc mockMvc;
+    
+    @DynamicPropertySource
+    static void elasticjobProperties(final DynamicPropertyRegistry registry) {
+        registry.add("elasticjob.regCenter.serverLists", () -> 
testingServer.getConnectString());
+        registry.add("elasticjob.dump.port", InstanceSpec::getRandomPort);
+    }
+    
+    @BeforeAll
+    static void beforeAll() throws Exception {
+        testingServer = new TestingServer(6181);
+        try (
+                CuratorZookeeperClient client = new 
CuratorZookeeperClient(testingServer.getConnectString(),
+                        60 * 1000, 500, null,
+                        new ExponentialBackoffRetry(500, 3, 500 * 3))) {
+            client.start();
+            Awaitility.await().atMost(Duration.ofMillis(500 * 
60)).ignoreExceptions().until(client::isConnected);
+        }
+    }
+    
+    @AfterAll
+    static void afterAll() throws IOException {
+        testingServer.close();
+    }
+    
+    @BeforeEach
+    void setup(final WebApplicationContext webApplicationContext) {
+        this.mockMvc = 
MockMvcBuilders.webAppContextSetup(webApplicationContext)
+                .defaultResponseCharacterEncoding(StandardCharsets.UTF_8)
+                .build();
+    }
+    
+    /**
+     * ElasticJob Spring Boot Starter requires that all Spring Boot 
Applications be shut down before shutting down Zookeeper Server.
+     * That's why this unit test uses {@link DirtiesContext}.
+     * Refer to <a 
href="https://github.com/spring-projects/spring-framework/issues/26196";>spring-projects/spring-framework#26196</a>
 .
+     */
+    @DirtiesContext
+    @Test
+    public void testOneOffJob() throws Exception {
+        String contentAsString = mockMvc.perform(
+                MockMvcRequestBuilders.get("/execute/manualScriptJob")
+                        .characterEncoding(StandardCharsets.UTF_8))
+                .andDo(MockMvcResultHandlers.print())
+                .andExpectAll(
+                        MockMvcResultMatchers.status().isOk(),
+                        
MockMvcResultMatchers.content().encoding(StandardCharsets.UTF_8))
+                .andReturn()
+                .getResponse()
+                .getContentAsString();
+        assertThat(contentAsString, is("{\"msg\":\"OK\"}"));
+    }
+}
diff --git a/test/native/src/test/resources/application.yml 
b/test/native/src/test/resources/application.yml
new file mode 100644
index 000000000..60e962615
--- /dev/null
+++ b/test/native/src/test/resources/application.yml
@@ -0,0 +1,52 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# `elasticjob.regCenter.serverLists` is dynamically defined in 
`org.apache.shardingsphere.elasticjob.test.natived.SpirngBootTest`
+# `elasticjob.dump.port` is dynamically defined in 
`org.apache.shardingsphere.elasticjob.test.natived.SpirngBootTest`
+elasticjob:
+  tracing:
+    type: RDB
+    data-source:
+      url: jdbc:h2:mem:job_event_storage
+      driver-class-name: org.h2.Driver
+      username: sa
+      password:
+  regCenter:
+    namespace: elasticjob-springboot
+  jobs:
+    simpleJob:
+      elasticJobClass: 
org.apache.shardingsphere.elasticjob.test.natived.commons.job.simple.SpringBootSimpleJob
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+    dataflowJob:
+      elasticJobClass: 
org.apache.shardingsphere.elasticjob.test.natived.commons.job.dataflow.SpringBootDataflowJob
+      cron: 0/5 * * * * ?
+      shardingTotalCount: 3
+      shardingItemParameters: 0=Beijing,1=Shanghai,2=Guangzhou
+    scriptJob:
+      elasticJobType: SCRIPT
+      cron: 0/10 * * * * ?
+      shardingTotalCount: 3
+      props:
+        script.command.line: "echo SCRIPT Job: "
+    manualScriptJob:
+      elasticJobType: SCRIPT
+      jobBootstrapBeanName: manualScriptJobBean
+      shardingTotalCount: 9
+      props:
+        script.command.line: "echo Manual SCRIPT Job: "

Reply via email to