From 005fa1707bb901a01a2f09c42dc226732074d338 Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Mon, 15 May 2023 15:58:58 +0800 Subject: [PATCH] arthas-spring-boot-starter support spring boot3. #2524 --- arthas-spring-boot-starter/pom.xml | 2 +- .../invoker.properties | 5 ++ .../pom.xml | 55 +++++++++++++++++++ ...asSpringBootStarterExampleApplication.java | 18 ++++++ .../src/main/resources/application.properties | 1 + ...ingBootStarterExampleApplicationTests.java | 13 +++++ .../verify.groovy | 3 + ...ot.autoconfigure.AutoConfiguration.imports | 2 + pom.xml | 1 + 9 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/invoker.properties create mode 100644 arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/pom.xml create mode 100644 arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplication.java create mode 100644 arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/resources/application.properties create mode 100644 arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/test/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplicationTests.java create mode 100644 arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/verify.groovy create mode 100644 arthas-spring-boot-starter/src/main/resources/META-INF/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/arthas-spring-boot-starter/pom.xml b/arthas-spring-boot-starter/pom.xml index 561502ef9..32f7906dc 100644 --- a/arthas-spring-boot-starter/pom.xml +++ b/arthas-spring-boot-starter/pom.xml @@ -83,8 +83,8 @@ integration-test + test - install run diff --git a/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/invoker.properties b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/invoker.properties new file mode 100644 index 000000000..3a335bcc6 --- /dev/null +++ b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/invoker.properties @@ -0,0 +1,5 @@ + +# A comma or space separated list of goals/phases to execute, may +# specify an empty list to execute the default goal of the IT project. +# Environment variables used by maven plugins can be added here +invoker.goals = clean spring-boot:run diff --git a/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/pom.xml b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/pom.xml new file mode 100644 index 000000000..b2f9d5366 --- /dev/null +++ b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + @spring-boot.version@ + + + com.example + arthas-spring-boot-starter-example + 0.0.1-SNAPSHOT + arthas-spring-boot-starter-example + Demo project for Spring Boot + + + 1.8 + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplication.java b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplication.java new file mode 100644 index 000000000..ff37c8aec --- /dev/null +++ b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplication.java @@ -0,0 +1,18 @@ +package com.example.arthasspringbootstarterexample; + +import java.util.concurrent.TimeUnit; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ArthasSpringBootStarterExampleApplication { + + public static void main(String[] args) throws InterruptedException { + SpringApplication.run(ArthasSpringBootStarterExampleApplication.class, args); + System.out.println("xxxxxxxxxxxxxxxxxx"); + TimeUnit.SECONDS.sleep(3); + System.exit(0); + } + +} diff --git a/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/resources/application.properties b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/resources/application.properties new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/test/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplicationTests.java b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/test/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplicationTests.java new file mode 100644 index 000000000..4468ab7a6 --- /dev/null +++ b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/src/test/java/com/example/arthasspringbootstarterexample/ArthasSpringBootStarterExampleApplicationTests.java @@ -0,0 +1,13 @@ +package com.example.arthasspringbootstarterexample; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class ArthasSpringBootStarterExampleApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/verify.groovy b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/verify.groovy new file mode 100644 index 000000000..0689b3a85 --- /dev/null +++ b/arthas-spring-boot-starter/src/it/arthas-spring-boot3-starter-example/verify.groovy @@ -0,0 +1,3 @@ +def file = new File(basedir, "build.log") +return file.text.contains("Arthas agent start success.") + diff --git a/arthas-spring-boot-starter/src/main/resources/META-INF/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/arthas-spring-boot-starter/src/main/resources/META-INF/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..b9db5dbfc --- /dev/null +++ b/arthas-spring-boot-starter/src/main/resources/META-INF/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ + com.alibaba.arthas.spring.ArthasConfiguration + com.alibaba.arthas.spring.endpoints.ArthasEndPointAutoConfiguration \ No newline at end of file diff --git a/pom.xml b/pom.xml index f2d72f5b6..838f969d1 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,7 @@ 1.8 1.8 2.7.11 + 3.0.6 3.0.0 2020-09-27T15:10:43Z 1.0.0