No1 OpenFirein 创建Spring Cloud Config (本地配置)
No1 OpenFirein 创建Spring Cloud Config (本地配置)
OpenFirein 发表于10个月前
No1 OpenFirein 创建Spring Cloud Config (本地配置)
  • 发表于 10个月前
  • 阅读 34
  • 收藏 0
  • 点赞 0
  • 评论 0

移动开发云端新模式探索实践 >>>   

Spring Cloud

分布式配置服务由服务器端和客户端共同组成,Server 端提供配置信息的存储管理,客户端完成配置信息的调度,这里先搭建服务器端。

1. 先看一下工程的层级关系

稍微大一点的图,吐槽下开源中国,太小了吧

2. 打开:OpenFirein\openfirein\pom.xml 这个pom.xml文件

下面是pom.xml的内容:

<?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.openfirein</groupId>
    <artifactId>openfirein</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <modules>
        <module>openfirein-cloud</module>
    </modules>
    <packaging>pom</packaging>

    <name>openfirein</name>
    <description>OpenFirein</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>

        <!--Spirng Boot 的版本-->
        <spring.boot.version>1.5.4.RELEASE</spring.boot.version>
        <!--Spirng Cloud 的版本-->
        <spring.cloud.version>1.3.1.RELEASE</spring.cloud.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- 此工程将作为父pom,不能直接增加<parent>,通过如下方式 配置Spirng Boot-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <version>${spring.boot.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <version>${spring.boot.version}</version>
                <scope>test</scope>
            </dependency>

            <!--配置管理开发工具包,可以让你把配置放到远程服务器,目前支持本地存储、Git以及Subversion-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-config</artifactId>
                <version>${spring.cloud.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-config-server</artifactId>
                <version>${spring.cloud.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

关于pom.xml中的 dependencyManagement 的一点说明:

Maven 使用dependencyManagement元素来提供了一种管理依赖版本号的方式。通常会在一个组织或者项目的最顶层的父POM中看到 dependencyManagement 元素。
使用pom.xml 中的dependencyManagement 元素能让所有在子项目中引用一个依赖而不用显式的列出版本号。
Maven 会沿着父子层次向上走,直到找到一个拥有dependencyManagement 元素的项目,然后它就会使用在这个dependencyManagement 元素中指定的版本号。
dependencyManagement里只是声明依赖,并不实现引入,因此子项目需要显式的声明需要用的依赖。
dependencies 相对于dependencyManagement,所有声明在dependencies里的依赖都会自动引入,并默认被所有的子项目继承。(摘自百度知道)

由于 dependencyManagement里只是声明依赖,并不实现引入 所以 openfirein-cloud-config-servier 中的pom.xml文件还是需要定义 dependencies 但是不再需要记录版本,由父节点统一提供。

 

<?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">
    <parent>
        <artifactId>openfirein-cloud</artifactId>
        <groupId>com.openfirein</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>openfirein-cloud-config-servier</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <!--配置管理开发工具包,可以让你把配置放到远程服务器,目前支持本地存储、Git以及Subversion-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
            <version>${spring.cloud.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>
    </dependencies>
</project>

ConfigServerStartApplication类:

package com.openfirein.config;

import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.config.server.EnableConfigServer;

// @SpringBootApplication 注解等价于以默认属性使用 @Configuration , @EnableAutoConfiguration 和 @ComponentScan 。
@SpringBootApplication
@EnableConfigServer
public class ConfigServerStartApplication {
    public static void main(String[] args) {
        SpringApplicationBuilder springApplicationBuilder = new SpringApplicationBuilder(ConfigServerStartApplication.class);
        springApplicationBuilder.web(true);
        springApplicationBuilder.bannerMode(Banner.Mode.CONSOLE);
        springApplicationBuilder.run(args);
    }
}

cloud-eureka-server-dev.yml    用两个空格来区分层次的。

server:
  port: 8088 #服务配置 端口号
  config:
    hostname: localhost #服务配置 主机名
spring:
  cloud:
    config:
      uri: http://${server.config.hostname}:${server.port} #访问服务配置的链接
      name: cloud-config-server #应用名称
      server:
        native:
          searchLocations: classpath:/properties/ #属性文件地址,可以指定文件夹的路径 file:D:/config/
  profiles:
    active: native #使用本地属性文件

文件中的:http://${server.config.hostname}:${server.port} 会被替换成 http://localhost:8088

cloud-eureka-server-dev.yml

#服务配置
server:
  port: 9800 # 端口号
  config:
    hostname: localhost #主机名
#表示是否将自己注册到Eureka Server上,默认为true,当前应用为Eureka Server所以无需注册
eureka:
  client:
    register-with-eureka: false
#表示是否从Eureka Server获取注册信息,默认为true。
#因为这是一个单点的Eureka Server,不需要同步其他的Eureka Server节点的数据,故而设为false。
    fetch-registry: false
#Eureka Server的访问地址,服务注册和client获取服务注册信息均通过该URL,多个服务注册地址用,隔开
    serviceUrl:
      defaultZone: http://${server.config.hostname}:${server.port}/eureka/

启动的信息:

"C:\Program Files\Java\jdk1.8.0_60\bin\java" -Dspring.output.ansi.enabled=always -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_60\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\rt.jar;D:\PROJECT\OpenFirein\openfirein\openfirein-cloud\openfirein-cloud-config-server\target\classes;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot-starter\1.5.4.RELEASE\spring-boot-starter-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot\1.5.4.RELEASE\spring-boot-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\spring-core\4.3.9.RELEASE\spring-core-4.3.9.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\spring-context\4.3.9.RELEASE\spring-context-4.3.9.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\spring-aop\4.3.9.RELEASE\spring-aop-4.3.9.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\spring-beans\4.3.9.RELEASE\spring-beans-4.3.9.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\spring-expression\4.3.9.RELEASE\spring-expression-4.3.9.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot-autoconfigure\1.5.4.RELEASE\spring-boot-autoconfigure-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot-starter-logging\1.5.4.RELEASE\spring-boot-starter-logging-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\cloud\spring-cloud-starter-config\1.3.1.RELEASE\spring-cloud-starter-config-1.3.1.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\cloud\spring-cloud-starter\1.2.2.RELEASE\spring-cloud-starter-1.2.2.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\cloud\spring-cloud-context\1.2.2.RELEASE\spring-cloud-context-1.2.2.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\security\spring-security-crypto\4.2.3.RELEASE\spring-security-crypto-4.2.3.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\cloud\spring-cloud-commons\1.2.2.RELEASE\spring-cloud-commons-1.2.2.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\security\spring-security-rsa\1.0.3.RELEASE\spring-security-rsa-1.0.3.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\cloud\spring-cloud-config-client\1.3.1.RELEASE\spring-cloud-config-client-1.3.1.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\spring-web\4.3.9.RELEASE\spring-web-4.3.9.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\com\fasterxml\jackson\core\jackson-databind\2.8.8\jackson-databind-2.8.8.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\com\fasterxml\jackson\core\jackson-core\2.8.8\jackson-core-2.8.8.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\cloud\spring-cloud-config-server\1.3.1.RELEASE\spring-cloud-config-server-1.3.1.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot-starter-actuator\1.5.4.RELEASE\spring-boot-starter-actuator-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot-actuator\1.5.4.RELEASE\spring-boot-actuator-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot-starter-web\1.5.4.RELEASE\spring-boot-starter-web-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\boot\spring-boot-starter-tomcat\1.5.4.RELEASE\spring-boot-starter-tomcat-1.5.4.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\apache\tomcat\embed\tomcat-embed-core\8.5.15\tomcat-embed-core-8.5.15.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\apache\tomcat\embed\tomcat-embed-el\8.5.15\tomcat-embed-el-8.5.15.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.15\tomcat-embed-websocket-8.5.15.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\hibernate\hibernate-validator\5.3.5.Final\hibernate-validator-5.3.5.Final.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\springframework\spring-webmvc\4.3.9.RELEASE\spring-webmvc-4.3.9.RELEASE.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\bouncycastle\bcpkix-jdk15on\1.55\bcpkix-jdk15on-1.55.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\bouncycastle\bcprov-jdk15on\1.55\bcprov-jdk15on-1.55.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\eclipse\jgit\org.eclipse.jgit\4.6.0.201612231935-r\org.eclipse.jgit-4.6.0.201612231935-r.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\com\jcraft\jsch\0.1.53\jsch-0.1.53.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\com\googlecode\javaewah\JavaEWAH\1.1.6\JavaEWAH-1.1.6.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\apache\httpcomponents\httpclient\4.5.3\httpclient-4.5.3.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\org\apache\httpcomponents\httpcore\4.4.6\httpcore-4.4.6.jar;D:\regatta-workspace\ProgramFiles\apache-maven-3.3.9\MavenRepository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.openfirein.config.ConfigServerStartApplication
2017-07-14 11:56:36.465  INFO 12628 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@71d44a3: startup date [Fri Jul 14 11:56:36 CST 2017]; root of context hierarchy
2017-07-14 11:56:36.709  INFO 12628 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$7f1d128a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

::: http://${eureka.instance.hostname}:8088/eureka/
::: OS (Windows 7)
::: JAVA (v1.8.0_60)
::: Spring-Boot (v1.5.4.RELEASE)

启动 Spring Cloud Config Server
链接: http://localhost:8088/
测试方式:http://localhost:8088/cloud-eureka-server/dev

2017-07-14 11:56:37.483  INFO 12628 --- [           main] c.o.config.ConfigServerStartApplication  : The following profiles are active: native
2017-07-14 11:56:37.495  INFO 12628 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2c7b5824: startup date [Fri Jul 14 11:56:37 CST 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@71d44a3
2017-07-14 11:56:38.224  INFO 12628 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=3dd406fa-bbc9-32b9-a8ff-85ac911ef13e
2017-07-14 11:56:38.289  INFO 12628 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$7f1d128a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-07-14 11:56:38.921  INFO 12628 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8088 (http)
2017-07-14 11:56:38.930  INFO 12628 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-07-14 11:56:38.932  INFO 12628 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.15
2017-07-14 11:56:39.056  INFO 12628 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-07-14 11:56:39.056  INFO 12628 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1561 ms
2017-07-14 11:56:39.304  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-07-14 11:56:39.308  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2017-07-14 11:56:39.308  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-07-14 11:56:39.308  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-07-14 11:56:39.308  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-07-14 11:56:39.308  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-07-14 11:56:39.308  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-07-14 11:56:39.308  INFO 12628 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-07-14 11:56:39.733  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2c7b5824: startup date [Fri Jul 14 11:56:37 CST 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@71d44a3
2017-07-14 11:56:39.789  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-07-14 11:56:39.790  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-07-14 11:56:39.795  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/encrypt],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.encrypt(java.lang.String,org.springframework.http.MediaType)
2017-07-14 11:56:39.795  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/encrypt/{name}/{profiles}],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.encrypt(java.lang.String,java.lang.String,java.lang.String,org.springframework.http.MediaType)
2017-07-14 11:56:39.796  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/decrypt/{name}/{profiles}],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.decrypt(java.lang.String,java.lang.String,java.lang.String,org.springframework.http.MediaType)
2017-07-14 11:56:39.796  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/decrypt],methods=[POST]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.decrypt(java.lang.String,org.springframework.http.MediaType)
2017-07-14 11:56:39.796  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/encrypt/status],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.config.server.encryption.EncryptionController.status()
2017-07-14 11:56:39.796  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/key],methods=[GET]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.getPublicKey()
2017-07-14 11:56:39.796  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/key/{name}/{profiles}],methods=[GET]}" onto public java.lang.String org.springframework.cloud.config.server.encryption.EncryptionController.getPublicKey(java.lang.String,java.lang.String)
2017-07-14 11:56:39.801  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}-{profiles}.properties],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.properties(java.lang.String,java.lang.String,boolean) throws java.io.IOException
2017-07-14 11:56:39.801  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}-{profiles}.yml || /{name}-{profiles}.yaml],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.yaml(java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2017-07-14 11:56:39.801  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profiles:.*[^-].*}],methods=[GET]}" onto public org.springframework.cloud.config.environment.Environment org.springframework.cloud.config.server.environment.EnvironmentController.defaultLabel(java.lang.String,java.lang.String)
2017-07-14 11:56:39.801  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{label}/{name}-{profiles}.yml || /{label}/{name}-{profiles}.yaml],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.labelledYaml(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2017-07-14 11:56:39.801  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}-{profiles}.json],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.jsonProperties(java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2017-07-14 11:56:39.802  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profiles}/{label:.*}],methods=[GET]}" onto public org.springframework.cloud.config.environment.Environment org.springframework.cloud.config.server.environment.EnvironmentController.labelled(java.lang.String,java.lang.String,java.lang.String)
2017-07-14 11:56:39.802  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{label}/{name}-{profiles}.properties],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.labelledProperties(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.io.IOException
2017-07-14 11:56:39.802  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{label}/{name}-{profiles}.json],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.labelledJsonProperties(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2017-07-14 11:56:39.804  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profile}/{label}/**],methods=[GET],produces=[application/octet-stream]}" onto public synchronized byte[] org.springframework.cloud.config.server.resource.ResourceController.binary(java.lang.String,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2017-07-14 11:56:39.805  INFO 12628 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{name}/{profile}/{label}/**],methods=[GET]}" onto public java.lang.String org.springframework.cloud.config.server.resource.ResourceController.retrieve(java.lang.String,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest,boolean) throws java.io.IOException
2017-07-14 11:56:39.826  INFO 12628 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-14 11:56:39.827  INFO 12628 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-14 11:56:39.854  INFO 12628 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-07-14 11:56:40.228  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.228  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2017-07-14 11:56:40.229  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.229  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.230  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.230  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/refresh || /refresh.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2017-07-14 11:56:40.231  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/features || /features.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.231  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.232  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/resume || /resume.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2017-07-14 11:56:40.232  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.233  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/restart || /restart.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.context.restart.RestartMvcEndpoint.invoke()
2017-07-14 11:56:40.234  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2017-07-14 11:56:40.235  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2017-07-14 11:56:40.235  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.236  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2017-07-14 11:56:40.236  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.236  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/pause || /pause.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2017-07-14 11:56:40.237  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.value(java.util.Map<java.lang.String, java.lang.String>)
2017-07-14 11:56:40.237  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/reset],methods=[POST]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.reset()
2017-07-14 11:56:40.238  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2017-07-14 11:56:40.238  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2017-07-14 11:56:40.239  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2017-07-14 11:56:40.239  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.240  INFO 12628 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-07-14 11:56:40.814  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-07-14 11:56:40.821  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2017-07-14 11:56:40.822  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshEndpoint' has been autodetected for JMX exposure
2017-07-14 11:56:40.822  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'restartEndpoint' has been autodetected for JMX exposure
2017-07-14 11:56:40.823  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'environmentManager' has been autodetected for JMX exposure
2017-07-14 11:56:40.824  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshScope' has been autodetected for JMX exposure
2017-07-14 11:56:40.825  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2017-07-14 11:56:40.835  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'restartEndpoint': registering with JMX server as MBean [org.springframework.cloud.context.restart:name=restartEndpoint,type=RestartEndpoint]
2017-07-14 11:56:40.842  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2017-07-14 11:56:40.848  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=2c7b5824,type=ConfigurationPropertiesRebinder]
2017-07-14 11:56:40.852  INFO 12628 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.endpoint:name=refreshEndpoint,type=RefreshEndpoint]
2017-07-14 11:56:40.943  INFO 12628 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2017-07-14 11:56:41.034  INFO 12628 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8088 (http)
2017-07-14 11:56:41.037  INFO 12628 --- [           main] c.o.config.ConfigServerStartApplication  : Started ConfigServerStartApplication in 5.539 seconds (JVM running for 6.01)

关于启动信息的第4行到第9行 是banner.txt提供的数据。

openfirein\openfirein-cloud\openfirein-cloud-config-server\src\main\resources\banner.txt

${AnsiColor.DEFAULT}
::: http://${eureka.instance.hostname}:${server.port}/eureka/
::: OS (${AnsiColor.YELLOW}${os.name}${AnsiColor.DEFAULT})
::: JAVA (v${AnsiColor.YELLOW}${java.version}${AnsiColor.DEFAULT})
::: Spring-Boot (v${AnsiColor.WHITE}${spring-boot.version}${AnsiColor.DEFAULT})

启动 Spring Cloud Config Server
链接: http://localhost:8088/
测试方式:http://localhost:8088/cloud-eureka-server/dev

如何查看cloud-eureka-server-dev.yml是否配置成功?

访问路径是由cloud-eureka-server/dev构成的

可以打开此链接:http://localhost:8088/cloud-eureka-server/dev

到此Spring Cloud Config 本地配置就结束了。

cloud-eureka-server-dev.yml是准备为Spring Cloud Eureka 准备的。

标签: Spring Cloud
  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 0
博文 6
码字总数 9552
×
OpenFirein
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: