Ling-cloud-config
来自ling
依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
启动注解
@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
public class ConfigApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigApplication.class, args);
}
}
文件形式配置
- 配置规则为:应用名+profile
- 公共配置放在application.properties
必须要一个消息总线支持
不配置的话,默认配置如下
spring.rabbitmq.host=localhost spring.rabbitmq.port=5672
手工配置如下
spring.rabbitmq.host=@rabbitmq.host@ spring.rabbitmq.port=@rabbitmq.port@ spring.rabbitmq.username=@rabbitmq.username@ spring.rabbitmq.password=@rabbitmq.password@
调试时使用的jvm参数
必须同时使用2个profile
--spring.profiles.active=native,dev
打包
启动
set BASE_DIR=D:\workspace\source\deloitte.cloud.parent\deloitte.cloud.configserver start java -jar %BASE_DIR%\target\deloitte.cloud.configserver-1.0.0.jar --server.port=8888 /S start java -jar %BASE_DIR%\target\deloitte.cloud.configserver-1.0.0.jar --server.port=8889 /S
延迟执行参考
@echo off
@ rem ---------- 设置延迟时间 ----------
@ set config_delay=15
@echo 延迟执行开始
@ ping 127.0.0.1 -n %config_delay%
@echo on
@echo 延迟执行结束