官方链接与文档 写道
https://spring.io/guides/gs/centralized-configuration/
Spring cloud config Server基于Spring boot构建,
- 建议下载使用官方的Eclipse ( sts-3.7.2.RELEASE)
- 下载config server sample 的源码,并导入到eclipse工程中,gs-centralized-configuration-complete\configuration-service
- 修改配置文件
- 启动程序
配置文件 maven文件:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>configuration-service</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.8.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.tmatesoft.svnkit</groupId> <artifactId>svnkit</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-parent</artifactId> <version>Angel.SR4</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
application.properties:
server.port=8888 spring.application.name=configServer #spring.cloud.config.server.git.uri=${HOME}/Desktop/config spring.profiles.active=subversion spring.cloud.config.server.svn.uri=svn://IP:port/project/config spring.cloud.config.server.svn.username=lvdccyb spring.cloud.config.enabled=true spring.cloud.config.server.svn.password=lvdccyb@126.com spring.main.show-banner=false
其中这3项表面使用svn,并需要注意,远程url可用。
spring.profiles.active=subversion spring.cloud.config.server.svn.uri=svn://IP:port/project/config spring.cloud.config.server.svn.username=lvdccyb
运行结果(部分内容去掉):
http://localhost:8888/env
{
"profiles": [
"subversion"
],
"bootstrap": {},
"servletContextInitParams": {},
"configServerClient": {
"spring.cloud.config.enabled": "false"
},
"applicationConfig: [classpath:/application.properties]": {
"spring.cloud.config.server.svn.password": "******",
"spring.cloud.config.server.svn.uri": "svn://X.Y.Z.U/project/config",
"server.port": "8888",
"spring.profiles.active": "subversion",
"spring.main.show-banner": "false",
"spring.cloud.config.enabled": "true",
"spring.cloud.config.server.svn.username": "lvdccyb",
"spring.application.name": "configServer"
},
"defaultProperties": {
"spring.application.name": "bootstrap"
}
}
http://localhost:8888/configuration-client/default 注意上面地址:对应的svn地址一般为: svn://IP:PORT/{$配置的uri}/trunk/configuration-client.properties 而且这个地址,需要仔细阅读spring 官方文档对application,profile,label的解释,以及路径的寻找优先级,上述地址缺省配置时,可以写成多种多样: http://localhost:8888/configuration-client/default/trunk http://localhost:8888/configuration-client/trunk/trunk http://localhost:8888/configuration-client/trunk 甚至如下: http://localhost:8888/configuration-client/abc 这里需要多一级trunk目录,而不是直接使用配置文件。 { "name": "configuration-client", "profiles": [ "default" ], "label": "trunk", "propertySources": [ { "name": "svn://IP:PORT/{$配置的uri}/trunk/configuration-client.properties", "source": { "IamApplicationName": "true", "message": "Hello World,I am spring client" } } ] }
相关推荐
根据需求,自动刷新springcloud config 中心的 配置,完整示例代码,可以运行起来
spring-cloud-config-svn-refresh:配置中心svn版本示例,客户端refresh版本示例 spring-cloud-config-eureka:配置中心服务化和高可用代码示例 spring-cloud-config-eureka-bus:配置中心和消息总线示例(配置中心...
- [spring-cloud-config-svn-refresh](https://github.com/ityouknow/spring-cloud-examples/tree/master/spring-cloud-config-svn-refresh):配置中心svn版本示例,客户端refresh版本示例 - [spring-cloud-config-...
spring-cloud-config-svn-refresh:配置中心svn版本示例,客户端refresh版本示例 spring-cloud-config-eureka:配置中心服务化和高可用代码示例 spring-cloud-config-eureka-bus:配置中心和消息总线示例(配置中心...
Jenkins+Svn+Docker+SpringCloud实现可持续自动化微服务
用于通过GIT,SVN或具有Java 8,Spring Cloud Finchley M8,Spring Cloud Config Server和Spring Cloud Starter Bus,JUnit 4的Java 8的GIT,SVN或HashiCorp Vault进行配置的中央管理的配置主服务器 参考文件 配置...
SVN远程配置.doc 帮助你配置SVN远程连接.在家工作更加方便.
项目管理工具使用Maven、版本控制工具使用SVN、项目自动部署工具使用Jenkins 消息中间件使用ActiveMQ、分布式任务调度系统使用XXLJOB、反向代理工具使用Nginx 日志管理插件工具使用lombok、分布式日志收集使用...
svn之——linux下清除svn的用户名和密码.rar
springboot spring cloud spring springMVC hibernate mybatis JavaEE Jenkins Svn Android js bootstrap等全套视频教程
使用 SpringCloud Eureka作为注册中心、Feign客户端调用工具、断路器Hystrix 视图展示使用Freemarker、数据库层使用Mybatis框架、缓存使用Redis、数据库使用MySQL 项目管理工具使用Maven、版本控制工具使用SVN、项目...
这个是SprngCloud商城相关文档,上传到svn上面,方便自己学习查看。里边包含了相关比较稳定等资料
config files of SVN server on LINUX OS with shell script for service start,stop and restart
1. Java基础知识: - 语法 - 面向对象编程 - 集合框架 - 异常处理 - 多线程编程 2. 数据库: - 熟悉SQL语言 - 了解关系型数据库和非关系型数据库 - 数据库连接池 - 数据库事务 3. Spring框架: - ...
使用VisualSVN Server搭建SVN服务器的文档简要说明
Config Server HTTP REST访问输出格式JSON(默认) 属性-YAML后端存储-GIT(默认)-SVN -Filessystems application.properties spring.cloud.config.server.gituri = <uri> 安全配置服务器其余端点GET / {...
本系统采用SpringCloud,SSM等框架,完成微服务网络办公系统的框架设计。主要实现了用户登录、会议管理、公告管理、文档管理、意见管理、员工管理等功能。采用Layui来完成前端页面的制作和美化,使用Jquery来实现...
svn服务器配置 svn服务器配置 svn服务器配置 svn服务器配置
Windows下使用VisualSVN Server搭建SVN服务器.docx