Spring Boot项目怎么远程读取Apollo配置文件
在项目的pom
文件中引入maven
依赖
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-core</artifactId>
<version>1.0.0</version>
</dependency>
在项目中创建application.properties
文件
app.id=app-shop-weixin
apollo.meta=http://192.168.78.130:8080
在启动类中加入@EnableApolloConfig
注解
@EnableEurekaClient
@SpringBootApplication
@EnableSwagger2Doc
@EnableApolloConfig
public class AppWeiXin {
public static void main(String[] args) {
SpringApplication.run(AppWeiXin.class,args);
}
}