1、在apollo点击“创建项目”,填写相关字段2、在pom.xml文件中添加如下:
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>1.1.0</version>
</dependency>
3、在application.yaml中加入如下配置:
app:
id: HCCloud
apollo:
meta: http://10.100.13.91:31363
bootstrap:
enabled: true
eagerLoad:
enabled: true
4、在主类中配置相关配置
@SpringBootApplication
@EnableScheduling
@EnableCaching
@EnableApolloConfig
@EnableConfigurationProperties
@EnableTransactionManagement
@MapperScan("com.hccloud.*.mapper")
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication .class, args);
}
}
5、在idea环境变量中配置
env=DEV;APOLLO_CONFIGSERVICE=服务url