Skip to content

Commit 769d42e

Browse files
fix:fix injection failure when customizing annotation instead of @SpringBootApplication. (#214)
Signed-off-by: Haotian Zhang <[email protected]>
1 parent ae5fd83 commit 769d42e

File tree

22 files changed

+1918
-82
lines changed

22 files changed

+1918
-82
lines changed

.github/workflows/junit.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Junit Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release/*
8+
paths-ignore:
9+
- '**.md'
10+
pull_request:
11+
branches:
12+
- main
13+
- release/*
14+
paths-ignore:
15+
- '**.md'
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Setup JDK 8
24+
uses: AdoptOpenJDK/install-jdk@v1
25+
with:
26+
version: '8'
27+
architecture: x64
28+
targets: 'JAVA_8_HOME'
29+
30+
- name: Setup JDK 11
31+
uses: AdoptOpenJDK/install-jdk@v1
32+
with:
33+
version: '11'
34+
architecture: x64
35+
targets: 'JAVA_11_HOME'
36+
37+
- name: Setup JDK 17
38+
uses: AdoptOpenJDK/install-jdk@v1
39+
with:
40+
version: '17'
41+
architecture: x64
42+
targets: 'JAVA_17_HOME;JAVA_HOME'
43+
44+
- name: Install xmllint
45+
run: sudo apt-get install libxml2-utils
46+
47+
- name: Get version
48+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
49+
- name: Test with Maven
50+
run: |
51+
export use_docker_env=false
52+
echo $JAVA_HOME
53+
echo $JAVA_8_HOME
54+
mvn clean test -B -U --file pom.xml

.github/workflows/license-checker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout codes
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818
- name: Check License Header
19-
uses: apache/skywalking-eyes@v0.4.0
19+
uses: apache/skywalking-eyes@v0.8.0

polaris-agent-build/bin/dev.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ fi
4040
echo "start to build package with offline mode"
4141

4242
if [[ "${use_docker_env}" == "true" ]]; then
43-
docker run --rm -u root -v "$(pwd)":/home/maven/project -w /home/maven/project maven:3.8.6-openjdk-8 mvn clean -B package --file pom.xml
43+
docker run --rm -u root -v "$(pwd)":/home/maven/project -w /home/maven/project maven:3.8.6-openjdk-8 mvn clean -B package --file pom.xml -Dmaven.test.skip=true
4444
else
45-
mvn clean -B package --file pom.xml
45+
mvn clean -B package --file pom.xml -Dmaven.test.skip=true
4646
fi
4747

4848
cp "polaris-agent-core/polaris-agent-core-bootstrap/target/polaris-agent-core-bootstrap.jar" "${folder_name}/"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Tencent is pleased to support the open source community by making polaris-java-agent available.
3+
*
4+
* Copyright (C) 2021 Tencent. All rights reserved.
5+
*
6+
* Licensed under the BSD 3-Clause License (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* https://opensource.org/licenses/BSD-3-Clause
11+
*
12+
* Unless required by applicable law or agreed to in writing, software distributed
13+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations under the License.
16+
*/
17+
18+
package cn.polarismesh.agent.examples.alibaba.cloud.cloud;
19+
20+
import org.springframework.boot.autoconfigure.SpringBootApplication;
21+
22+
import java.lang.annotation.*;
23+
24+
/**
25+
* Wrap of @SpringBootApplication.
26+
*
27+
* @author Haotian Zhang
28+
*/
29+
@Target({ElementType.TYPE})
30+
@Retention(RetentionPolicy.RUNTIME)
31+
@Documented
32+
@Inherited
33+
@SpringBootApplication
34+
public @interface MySpringBootApplication {
35+
}

polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2021-examples/quickstart-examples/provider-b/src/main/java/cn/polarismesh/agent/examples/alibaba/cloud/cloud/ProviderApplication.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.slf4j.LoggerFactory;
2323
import org.springframework.beans.factory.annotation.Value;
2424
import org.springframework.boot.SpringApplication;
25-
import org.springframework.boot.autoconfigure.SpringBootApplication;
2625
import org.springframework.cloud.client.serviceregistry.Registration;
2726
import org.springframework.cloud.context.config.annotation.RefreshScope;
2827
import org.springframework.http.HttpStatus;
@@ -34,7 +33,7 @@
3433
/**
3534
* @author <a href="mailto:[email protected]">liaochuntao</a>
3635
*/
37-
@SpringBootApplication
36+
@MySpringBootApplication
3837
public class ProviderApplication {
3938

4039
public static void main(String[] args) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Tencent is pleased to support the open source community by making polaris-java-agent available.
3+
*
4+
* Copyright (C) 2021 Tencent. All rights reserved.
5+
*
6+
* Licensed under the BSD 3-Clause License (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* https://opensource.org/licenses/BSD-3-Clause
11+
*
12+
* Unless required by applicable law or agreed to in writing, software distributed
13+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations under the License.
16+
*/
17+
18+
package cn.polarismesh.agent.examples.alibaba.cloud.cloud;
19+
20+
import org.springframework.boot.autoconfigure.SpringBootApplication;
21+
22+
import java.lang.annotation.*;
23+
24+
/**
25+
* Wrap of @SpringBootApplication.
26+
*
27+
* @author Haotian Zhang
28+
*/
29+
@Target({ElementType.TYPE})
30+
@Retention(RetentionPolicy.RUNTIME)
31+
@Documented
32+
@Inherited
33+
@SpringBootApplication
34+
public @interface MySpringBootApplication {
35+
}

polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2022-examples/quickstart-examples/provider-b/src/main/java/cn/polarismesh/agent/examples/alibaba/cloud/cloud/ProviderApplication.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.slf4j.LoggerFactory;
2424
import org.springframework.beans.factory.annotation.Value;
2525
import org.springframework.boot.SpringApplication;
26-
import org.springframework.boot.autoconfigure.SpringBootApplication;
2726
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
2827
import org.springframework.cloud.context.config.annotation.RefreshScope;
2928
import org.springframework.http.HttpStatus;
@@ -36,7 +35,7 @@
3635
* @author <a href="mailto:[email protected]">liaochuntao</a>
3736
*/
3837
@EnableDiscoveryClient
39-
@SpringBootApplication
38+
@MySpringBootApplication
4039
public class ProviderApplication {
4140

4241
public static void main(String[] args) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Tencent is pleased to support the open source community by making polaris-java-agent available.
3+
*
4+
* Copyright (C) 2021 Tencent. All rights reserved.
5+
*
6+
* Licensed under the BSD 3-Clause License (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* https://opensource.org/licenses/BSD-3-Clause
11+
*
12+
* Unless required by applicable law or agreed to in writing, software distributed
13+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations under the License.
16+
*/
17+
18+
package cn.polarismesh.agent.examples.alibaba.cloud.cloud;
19+
20+
import org.springframework.boot.autoconfigure.SpringBootApplication;
21+
22+
import java.lang.annotation.*;
23+
24+
/**
25+
* Wrap of @SpringBootApplication.
26+
*
27+
* @author Haotian Zhang
28+
*/
29+
@Target({ElementType.TYPE})
30+
@Retention(RetentionPolicy.RUNTIME)
31+
@Documented
32+
@Inherited
33+
@SpringBootApplication
34+
public @interface MySpringBootApplication {
35+
}

polaris-agent-examples/spring-cloud-plugins-examples/spring-cloud-2023-examples/quickstart-examples/provider-b/src/main/java/cn/polarismesh/agent/examples/alibaba/cloud/cloud/ProviderApplication.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.slf4j.LoggerFactory;
2323
import org.springframework.beans.factory.annotation.Value;
2424
import org.springframework.boot.SpringApplication;
25-
import org.springframework.boot.autoconfigure.SpringBootApplication;
2625
import org.springframework.cloud.client.serviceregistry.Registration;
2726
import org.springframework.cloud.context.config.annotation.RefreshScope;
2827
import org.springframework.http.HttpStatus;
@@ -34,7 +33,7 @@
3433
/**
3534
* @author <a href="mailto:[email protected]">liaochuntao</a>
3635
*/
37-
@SpringBootApplication
36+
@MySpringBootApplication
3837
public class ProviderApplication {
3938

4039
public static void main(String[] args) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Tencent is pleased to support the open source community by making polaris-java-agent available.
3+
*
4+
* Copyright (C) 2021 Tencent. All rights reserved.
5+
*
6+
* Licensed under the BSD 3-Clause License (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* https://opensource.org/licenses/BSD-3-Clause
11+
*
12+
* Unless required by applicable law or agreed to in writing, software distributed
13+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations under the License.
16+
*/
17+
18+
package cn.polarismesh.agent.examples.alibaba.cloud.cloud;
19+
20+
import org.springframework.boot.autoconfigure.SpringBootApplication;
21+
22+
import java.lang.annotation.*;
23+
24+
/**
25+
* Wrap of @SpringBootApplication.
26+
*
27+
* @author Haotian Zhang
28+
*/
29+
@Target({ElementType.TYPE})
30+
@Retention(RetentionPolicy.RUNTIME)
31+
@Documented
32+
@Inherited
33+
@SpringBootApplication
34+
public @interface MySpringBootApplication {
35+
}

0 commit comments

Comments
 (0)