Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit a7d5a4e

Browse files
committed
update apollo samples
1 parent a48ea15 commit a7d5a4e

File tree

6 files changed

+27
-17
lines changed

6 files changed

+27
-17
lines changed

samples/springboot-samples/config/apollo/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ System.setProperty("env", "DEV");
2222
```
2323
3. pom 里引入 apollo 依赖
2424

25-
4. 模块代码里添加 apollo 多应用治理类 `com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer`, 注意基座里不要引入
25+
4. 基座和模块代码里都添加 apollo 多应用治理类 `com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer`
2626
引入覆盖 apollo 原有逻辑的治理类,与原生的类实现的区别在于如下一行
2727
![diff.png](imgs/diff.png)
28-
5. 模块里添加 apollo 配置文件 `/META-INF/app.properties`
28+
5. 基座和模块里都添加 apollo 配置文件 `/META-INF/app.properties`
2929
由于注释了 initializeSystemProperty 方法,导致无法通过 application.properties 对 apollo 进行配置, 初始化 `app.id`。所以模块里需要使用 `/META-INF/app.properties` 进行配置。
3030
![init.png](imgs/init.png)
3131

@@ -34,7 +34,7 @@ System.setProperty("env", "DEV");
3434
```shell
3535
docker-compose up
3636
```
37-
2. 登录 apollo 管理后台,创建 app id 为 `biz` 的项目和 key=data.name 的配置,创建 app id 为 `biz2` 的项目和 key=data.name 的配置,具体查看 https://www.apolloconfig.com/#/zh/deployment/quick-start
37+
2. 登录 apollo 管理后台 `localhost:8080`,创建 app id 为 `biz` 的项目和 key=data.name 的配置,创建 app id 为 `biz2` 的项目和 key=data.name 的配置,具体查看 https://www.apolloconfig.com/#/zh/deployment/quick-start
3838
3. 执行 `mvn clean package -DskipTests`,然后启动基座
3939
4. 进入 apollo 目录,执行 `arkctl deploy biz1/target/biz1-apollo-0.0.1-SNAPSHOT-ark-biz.jar`, 安装 biz1 模块
4040
5. 进入 apollo 目录,执行 `arkctl deploy biz2/target/biz2-apollo-0.0.1-SNAPSHOT-ark-biz.jar`, 安装 biz2 模块

samples/springboot-samples/config/apollo/base/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@
5858
<artifactId>guice</artifactId>
5959
<version>5.1.0</version>
6060
</dependency>
61+
62+
<dependency>
63+
<groupId>org.projectlombok</groupId>
64+
<artifactId>lombok</artifactId>
65+
</dependency>
66+
67+
<!-- <dependency>-->
68+
<!-- <groupId>com.alipay.sofa.serverless</groupId>-->
69+
<!-- <artifactId>sofa-serverless-adapter-apollo</artifactId>-->
70+
<!-- <version>${sofa.serverless.runtime.version}</version>-->
71+
<!-- </dependency>-->
6172
</dependencies>
6273

6374
<build>

samples/springboot-samples/config/apollo/base/src/main/resources/application.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
spring.application.name=base-apollo
2+
server.port=8081
23

34
app.id=SampleApp
4-
5-
server.port=8081
65
apollo.bootstrap.enabled=true
76
apollo.bootstrap.eagerLoad.enabled=true
87
apollo.bootstrap.namespaces=application

samples/springboot-samples/config/apollo/biz1/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@
4444
<artifactId>spring-cloud-context</artifactId>
4545
</dependency>
4646

47-
<dependency>
48-
<groupId>com.alipay.sofa.serverless</groupId>
49-
<artifactId>sofa-serverless-base-starter</artifactId>
50-
</dependency>
51-
5247
<dependency>
5348
<groupId>com.google.inject</groupId>
5449
<artifactId>guice</artifactId>
5550
<version>5.1.0</version>
5651
</dependency>
52+
53+
<dependency>
54+
<groupId>org.projectlombok</groupId>
55+
<artifactId>lombok</artifactId>
56+
</dependency>
5757
</dependencies>
5858

5959
<build>

samples/springboot-samples/config/apollo/biz2/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@
4444
<artifactId>spring-cloud-context</artifactId>
4545
</dependency>
4646

47-
<dependency>
48-
<groupId>com.alipay.sofa.serverless</groupId>
49-
<artifactId>sofa-serverless-base-starter</artifactId>
50-
</dependency>
51-
5247
<dependency>
5348
<groupId>com.google.inject</groupId>
5449
<artifactId>guice</artifactId>
5550
<version>5.1.0</version>
5651
</dependency>
52+
53+
<dependency>
54+
<groupId>org.projectlombok</groupId>
55+
<artifactId>lombok</artifactId>
56+
</dependency>
5757
</dependencies>
5858

5959
<build>

samples/springboot-samples/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<properties>
2121
<spring.boot.version>2.7.16</spring.boot.version>
2222
<java.version>1.8</java.version>
23-
<sofa.ark.version>2.2.5-SNAPSHOT</sofa.ark.version>
24-
<sofa.serverless.runtime.version>0.5.4</sofa.serverless.runtime.version>
23+
<sofa.ark.version>2.2.5</sofa.ark.version>
24+
<sofa.serverless.runtime.version>0.5.5</sofa.serverless.runtime.version>
2525
<disruptor.version>3.4.2</disruptor.version>
2626
<os.plugin.version>1.7.1</os.plugin.version>
2727
<protobuf.plugin.version>0.6.1</protobuf.plugin.version>

0 commit comments

Comments
 (0)