此处主要配置Spring cloud config ++client++
- 在项目pom文件中添加如下依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
- 添加dependencyManagement
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId> <version>Camden.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
- 配置bootstarp.properties(test env for example)
spring.cloud.config.uri=[your-server]:3721
spring.application.name=[appname-from gitlab]
spring.cloud.config.username=[username]
spring.cloud.config.password=[password]
- 项目同级文件中还需有以下文件
- [project_name].conf
export JAVA_OPTS="-Xms1024m -Xmx1024m -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=test"
* logfile.xml(如果需要log配置文件的话,需要在application.properties中添加如下配置)
logging.config=[path-to-log-file]