SpringBoot配置搭建Apollo

SpringBoot配置搭建Apollo

1.windows环境下apollo单机搭建 

环境准备:JDK1.8,mysql 5.7.6+, git-2.21.0(执行apollo的启动脚本) https://git-scm.com/downloadsapollo安装包(官网为我们准备了 Quick Start 安装包。大家只需要下载到本地,就可以直接使用,免去了编译、打包过程。大家可以到github下载,也可以通过百度云盘下载

2.apollo配置具体过程参考文献:springboot2.0从apollo读取配置

3.注意使用:切记mysql服务要启动,8080、8070、8090这三个端口不要被占用,也不要随意改动这三个端口

4.SpringBoot Apollo配置依赖:

<apollo-client.version>1.1.0</apollo-client.version>


<dependency>
	<groupId>com.ctrip.framework.apollo</groupId>
	<artifactId>apollo-client</artifactId>
	<version>${apollo-client.version}</version>
</dependency>

<dependency>
	<groupId>com.ctrip.framework.apollo</groupId>
	<artifactId>apollo-core</artifactId>
	<version>${apollo-client.version}</version>
</dependency>

5.环境切分配置pom.xml: 

<profiles>
	<profile>    <!--开发环境-->
		<id>dev</id>
		<properties>
			<profiles.active>dev</profiles.active>
		</properties>
		<activation>
			<activeByDefault>true</activeByDefault>
		</activation>
	</profile>
	<profile>       <!--准生产环境-->
		<id>uat</id>
		<properties>
			<profiles.active>uat</profiles.active>
		</properties>
	</profile>
	<profile>       <!--生产环境-->
		<id>pro</id>
		<properties>
			<profiles.active>pro</profiles.active>
		</properties>
	</profile>
</profiles>

6.[application.yml]配置:

server:
  port: 9099
#spring:
#  application:
#    name: apolloDeno
# Apollo配置ID
app:
  id: 110
# set apollo meta server address, adjust to actual address if necessary
apollo:
  meta: ip + port
  bootstrap:
        enabled : true

7.参考文献:Spring Boot 2.0 整合携程Apollo配置中心 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值