This repository was archived by the owner on Feb 18, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +27
-17
lines changed
samples/springboot-samples Expand file tree Collapse file tree 6 files changed +27
-17
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ System.setProperty("env", "DEV");
2222```
23233 . 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
3535docker-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
38383 . 执行 ` mvn clean package -DskipTests ` ,然后启动基座
39394 . 进入 apollo 目录,执行 ` arkctl deploy biz1/target/biz1-apollo-0.0.1-SNAPSHOT-ark-biz.jar ` , 安装 biz1 模块
40405 . 进入 apollo 目录,执行 ` arkctl deploy biz2/target/biz2-apollo-0.0.1-SNAPSHOT-ark-biz.jar ` , 安装 biz2 模块
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 11spring.application.name =base-apollo
2+ server.port =8081
23
34app.id =SampleApp
4-
5- server.port =8081
65apollo.bootstrap.enabled =true
76apollo.bootstrap.eagerLoad.enabled =true
87apollo.bootstrap.namespaces =application
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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>
You can’t perform that action at this time.
0 commit comments