spring-cloud-config-server 集群

spring-cloud-config-server 服务器搭建这篇文章介绍了如何搭建配置服务器及如何使用配置服务器加载配置。但是上面的都是针对单机的配置服务器,虽然集群的配置服务器基本没用到过,但是这里贴一下如何搭建及使用集群的配置服务器

相比较单机的config服务器,集群的服务器需要将服务注册到eureka上去(eureka服务器搭建参考spring-cloud-eureka服务发现注册中心及spring-cloud微服务),所以需要导入spring-cloud-starter-netflix-eureka-client依赖,并配置eureka client

pom.xml     与单机的配置服务器多了spring-cloud-starter-netflix-eureka-client依赖(注意其与spring-cloud-server的版本)

<?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.wl.config</groupId>
  <artifactId>config-service</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>config-service</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <daylife-version>1.0-SNAPSHOT</daylife-version>
    <MainClass>com.wl.config.Application</MainClass>
    <spring-cloud-eureka-client-version>1.4.5.RELEASE</spring-cloud-eureka-client-version>

    <spring-boot-version>1.5.7.RELEASE</spring-boot-version>

    <spring-cloud-starter-config-version>1.2.2.RELEASE</spring-cloud-starter-config-version>

    <slf4j-api-version>1.7.5</slf4j-api-version>

    <!-- groovy -->
    <groovy-all-version>2.4.5</groovy-all-version>

    <!-- 测试 -->
    <junit.version>4.12</junit.version>
    <groovy-all-version>2.4.5</groovy-all-version>
    <spock-core-version>1.1-groovy-2.4</spock-core-version>
  </properties>

  <dependencies>

    <!-- spring boot -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <version>${spring-boot-version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-client -->
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
      <version>${spring-cloud-eureka-client-version}</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-config -->
    <!-- 依赖 spring-web -->
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-config</artifactId>
      <version>${spring-cloud-starter-config-version}</version>
      <exclusions>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
        </exclusion>
      </exclusions>
    </dependency>



    <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-config-server -->
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-config-server</artifactId>
      <version>${spring-cloud-starter-config-version}</version>
    </dependency>



    <!---日志 -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-api-version}</version>
    </dependency>



    <!-- https://mvnrepository.com/artifact/com.github.sgroschupf/zkclient -->
    <dependency>
      <groupId>com.github.sgroschupf</groupId>
      <artifactId>zkclient</artifactId>
      <version>0.1</version>

      <exclusions>
        <exclusion>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- groovy -->
    <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>${groovy-all-version}</version>
    </dependency>

    <!-- 测试依赖  scope test   不会打进jar包 -->

    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.spockframework/spock-core -->
    <dependency>
      <groupId>org.spockframework</groupId>
      <artifactId>spock-core</artifactId>
      <version>${spock-core-version}</version>
      <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <version>${spring-boot-version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-autoconfigure</artifactId>
      <version>${spring-boot-version}</version>
    </dependency>
  </dependencies>

  <!-- Package as an executable jar -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot-version}</version>
        <configuration>
          <mainClass>${MainClass}</mainClass>
          <layout>JAR</layout>
        </configuration>
        <!-- repackage  生成两个 jar.original -->
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- 指定maven 打包java 版本 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
    <!-- maven  编译打包resource 和 java 目录下所有文件  maven默认资源路径是resources -->
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.*</include>
          <include>*.*</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.*</include>
          <include>*.*</include>
        </includes>
      </resource>
    </resources>
  </build>

</project>

这里有些多余的引用包没有去除掉 

application.properties

server.port=8888
#spring.cloud.config.server.git.uri=http://192.168.245.128:8000/config.git
#spring.cloud.config.server.git.password=123456
#spring.cloud.config.server.git.username=git
#spring.cloud.config.server.native.searchLocations=classpath:/config

server.context-path=/
spring.cloud.config.server.native.searchLocations=file:///D:\\workspace\\wl\\study\\config
spring.profiles.active=native
#=====================================eureka配置
eureka.client.serviceUrl.defaultZone=http\://localhost\:8761/eureka/
spring.application.name=config-server-client
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true

启动类(多了EnableDiscoveryClient注解)

package com.wl.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.config.server.EnableConfigServer;

/**
 * Created by wl on 2019/3/7.
 */
@SpringBootApplication(exclude = {
        DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class             //不使用数据库
},scanBasePackages = "com.wl")
@EnableConfigServer
@EnableDiscoveryClient
public class Application {

    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(Application.class);
        app.setWebEnvironment(true);
        app.run(args);
        logger.info("application init success");
    }

}

下面使用不同的端口来模拟集群

打包

D:\workspace\wl\study\service\config-service>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.wl.config:config-service >--------------------
[INFO] Building config-service 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ config-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ config-service ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\workspace\wl\study\service\config-service\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ config-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ config-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ config-service ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ config-service ---
[INFO] Building jar: D:\workspace\wl\study\service\config-service\target\config-service-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.7.RELEASE:repackage (default) @ config-service ---
[INFO] Layout: JAR
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.305 s
[INFO] Finished at: 2019-03-11T21:51:26+08:00
[INFO] ------------------------------------------------------------------------

D:\workspace\wl\study\service\config-service>

指定不同端口执行两次(8888和8999)

D:\workspace\wl\study\service\config-service>cd target

D:\workspace\wl\study\service\config-service\target>java -jar config-service-1.0-SNAPSHOT.jar --server.port=8888
2019-03-11 21:52:58.834  INFO 3624 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4f8e5cde: startup date [Mon Mar 11 21:52:58 CST 2019]; root of context hierarchy
2019-03-11 21:52:59.083  INFO 3624 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-03-11 21:52:59.118  INFO 3624 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b8e7ea4c] is not eligible
for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.7.RELEASE)

2019-03-11 21:53:00.471  INFO 3624 --- [           main] com.wl.config.Application                : The following profiles are active: native
2019-03-11 21:53:00.493  INFO 3624 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@24b1d79b: startup date [Mon Mar 11 21:53:00 CST 2019]; parent: org.springframework.context.annotation.Ann
otationConfigApplicationContext@4f8e5cde
2019-03-11 21:53:01.299  INFO 3624 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'environmentRepository' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; auto
wireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.config.server.config.EnvironmentRepositoryConfiguration$GitRepositoryConfiguration; factoryMethodName=environmentRepository; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework
/cloud/config/server/config/EnvironmentRepositoryConfiguration$GitRepositoryConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.config.server.confi
g.EnvironmentRepositoryConfiguration$NativeRepositoryConfiguration; factoryMethodName=environmentRepository; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration$NativeRepositoryConfiguration.
class]]
2019-03-11 21:53:01.464  INFO 3624 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=db22aff0-ac22-3c70-9cea-b90eab66a6cd
2019-03-11 21:53:01.482  INFO 3624 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-03-11 21:53:01.546  INFO 3624 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerB
ySpringCGLIB$$b8e7ea4c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-11 21:53:01.870  INFO 3624 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8888 (http)
2019-03-11 21:53:01.881  INFO 3624 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-03-11 21:53:01.882  INFO 3624 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.20
2019-03-11 21:53:01.965  INFO 3624 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-03-11 21:53:01.966  INFO 3624 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1473 ms
2019-03-11 21:53:02.178  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2019-03-11 21:53:02.182  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2019-03-11 21:53:02.183  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-03-11 21:53:02.183  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-03-11 21:53:02.183  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-03-11 21:53:02.183  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-03-11 21:53:02.183  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2019-03-11 21:53:02.183  INFO 3624 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2019-03-11 21:53:02.352  WARN 3624 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-03-11 21:53:02.353  INFO 3624 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-03-11 21:53:02.359  WARN 3624 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-03-11 21:53:02.359  INFO 3624 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-03-11 21:53:02.704  INFO 3624 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@24b1d79b: startup date [Mon Mar 11 21:53:00 CST 2019]; parent: org.springframework.co
ntext.annotation.AnnotationConfigApplicationContext@4f8e5cde
2019-03-11 21:53:02.776  INFO 3624 --- [           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.servl
et.http.HttpServletRequest)
2019-03-11 21:53:02.778  INFO 3624 --- [           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.HttpServletRe
quest,javax.servlet.http.HttpServletResponse)
2019-03-11 21:53:02.784  INFO 3624 --- [           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)
2019-03-11 21:53:02.785  INFO 3624 --- [           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.l
ang.String,org.springframework.http.MediaType)
2019-03-11 21:53:02.785  INFO 3624 --- [           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.l
ang.String,org.springframework.http.MediaType)
2019-03-11 21:53:02.785  INFO 3624 --- [           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)
2019-03-11 21:53:02.786  INFO 3624 --- [           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()
2019-03-11 21:53:02.786  INFO 3624 --- [           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()
2019-03-11 21:53:02.786  INFO 3624 --- [           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)
2019-03-11 21:53:02.791  INFO 3624 --- [           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.pro
perties(java.lang.String,java.lang.String,boolean) throws java.io.IOException
2019-03-11 21:53:02.792  INFO 3624 --- [           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.e
nvironment.EnvironmentController.labelledYaml(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2019-03-11 21:53:02.792  INFO 3624 --- [           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.labe
lled(java.lang.String,java.lang.String,java.lang.String)
2019-03-11 21:53:02.792  INFO 3624 --- [           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.jsonPrope
rties(java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2019-03-11 21:53:02.792  INFO 3624 --- [           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.defaul
tLabel(java.lang.String,java.lang.String)
2019-03-11 21:53:02.792  INFO 3624 --- [           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.Envir
onmentController.yaml(java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2019-03-11 21:53:02.793  INFO 3624 --- [           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.EnvironmentContro
ller.labelledProperties(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.io.IOException
2019-03-11 21:53:02.793  INFO 3624 --- [           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.l
abelledJsonProperties(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.lang.Exception
2019-03-11 21:53:02.795  INFO 3624 --- [           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.resolve(java.lang.String,java.lang.String,java.lang
.String,javax.servlet.http.HttpServletRequest) throws java.io.IOException
2019-03-11 21:53:02.796  INFO 3624 --- [           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
2019-03-11 21:53:02.830  INFO 3624 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 21:53:02.830  INFO 3624 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 21:53:02.874  INFO 3624 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 21:53:04.116  INFO 3624 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 21:53:04.253  WARN 3624 --- [           main] figurationPropertiesBindingPostProcessor : The @ConfigurationProperties bean class org.springframework.cloud.client.actuator.FeaturesEndpoint contains validation constraints but had not been annotated with @Validated.
2019-03-11 21:53:04.253  WARN 3624 --- [           main] figurationPropertiesBindingPostProcessor : The @ConfigurationProperties bean class org.springframework.cloud.client.actuator.FeaturesEndpoint contains validation constraints but had not been annotated with @Validated.
2019-03-11 21:53:04.254  WARN 3624 --- [           main] figurationPropertiesBindingPostProcessor : The @ConfigurationProperties bean class org.springframework.cloud.client.actuator.FeaturesEndpoint contains validation constraints but had not been annotated with @Validated.
2019-03-11 21:53:05.357  INFO 3624 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 21:53:05.706  WARN 3624 --- [           main] figurationPropertiesBindingPostProcessor : The @ConfigurationProperties bean class org.springframework.cloud.endpoint.RefreshEndpoint contains validation constraints but had not been annotated with @Validated.
2019-03-11 21:53:05.707  WARN 3624 --- [           main] figurationPropertiesBindingPostProcessor : The @ConfigurationProperties bean class org.springframework.cloud.endpoint.RefreshEndpoint contains validation constraints but had not been annotated with @Validated.
2019-03-11 21:53:05.707  WARN 3624 --- [           main] figurationPropertiesBindingPostProcessor : The @ConfigurationProperties bean class org.springframework.cloud.endpoint.RefreshEndpoint contains validation constraints but had not been annotated with @Validated.
2019-03-11 21:53:05.734  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.735  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2019-03-11 21:53:05.735  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.735  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/info || /info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.736  INFO 3624 --- [           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>)
2019-03-11 21:53:05.736  INFO 3624 --- [           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()
2019-03-11 21:53:05.736  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.736  INFO 3624 --- [           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()
2019-03-11 21:53:05.737  INFO 3624 --- [           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.h
ttp.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2019-03-11 21:53:05.737  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/features || /features.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.738  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.738  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/service-registry/instance-status],methods=[GET]}" onto public org.springframework.http.ResponseEntity org.springframework.cloud.client.serviceregistry.endpoint.ServiceRegistryEndpoint.getStatus
()
2019-03-11 21:53:05.738  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/service-registry/instance-status],methods=[POST]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.cloud.client.serviceregistry.endpoint.ServiceRegistryEndpoint.setSt
atus(java.lang.String)
2019-03-11 21:53:05.738  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/archaius || /archaius.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.739  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2019-03-11 21:53:05.740  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.741  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2019-03-11 21:53:05.741  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env || /env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.742  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:05.742  INFO 3624 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2019-03-11 21:53:06.201  INFO 3624 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2019-03-11 21:53:06.209  INFO 3624 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2019-03-11 21:53:06.210  INFO 3624 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshEndpoint' has been autodetected for JMX exposure
2019-03-11 21:53:06.210  INFO 3624 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'environmentManager' has been autodetected for JMX exposure
2019-03-11 21:53:06.210  INFO 3624 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'serviceRegistryEndpoint' has been autodetected for JMX exposure
2019-03-11 21:53:06.211  INFO 3624 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshScope' has been autodetected for JMX exposure
2019-03-11 21:53:06.213  INFO 3624 --- [           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]
2019-03-11 21:53:06.224  INFO 3624 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located managed bean 'serviceRegistryEndpoint': registering with JMX server as MBean [org.springframework.cloud.client.serviceregistry.endpoint:name=serviceRegistryEndpoint,type=ServiceRegistryEndpoint]
2019-03-11 21:53:06.231  INFO 3624 --- [           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]
2019-03-11 21:53:06.244  INFO 3624 --- [           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=24b1d79b,type=Config
urationPropertiesRebinder]
2019-03-11 21:53:06.249  INFO 3624 --- [           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]
2019-03-11 21:53:06.263  INFO 3624 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2019-03-11 21:53:06.279  INFO 3624 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2019-03-11 21:53:06.331  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2019-03-11 21:53:06.563  INFO 3624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2019-03-11 21:53:06.563  INFO 3624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2019-03-11 21:53:06.725  INFO 3624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2019-03-11 21:53:06.725  INFO 3624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2019-03-11 21:53:06.919  INFO 3624 --- [           main] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-03-11 21:53:06.989  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2019-03-11 21:53:06.990  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2019-03-11 21:53:06.990  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2019-03-11 21:53:06.990  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Application is null : false
2019-03-11 21:53:06.990  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2019-03-11 21:53:06.990  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2019-03-11 21:53:06.990  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2019-03-11 21:53:07.176  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : The response status is 200
2019-03-11 21:53:07.178  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2019-03-11 21:53:07.180  INFO 3624 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-03-11 21:53:07.182  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1552312387182 with initial instances count: 2
2019-03-11 21:53:07.185  INFO 3624 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application config-server-client with eureka with status UP
2019-03-11 21:53:07.186  INFO 3624 --- [           main] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1552312387186, current=UP, previous=STARTING]
2019-03-11 21:53:07.187  INFO 3624 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_CONFIG-SERVER-CLIENT/localhost:config-server-client:8888: registering service...
2019-03-11 21:53:07.219  INFO 3624 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_CONFIG-SERVER-CLIENT/localhost:config-server-client:8888 - registration status: 204
2019-03-11 21:53:07.276  INFO 3624 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8888 (http)
2019-03-11 21:53:07.277  INFO 3624 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8888
2019-03-11 21:53:07.280  INFO 3624 --- [           main] com.wl.config.Application                : Started Application in 10.135 seconds (JVM running for 10.542)
2019-03-11 21:53:07.281  INFO 3624 --- [           main] com.wl.config.Application                : application init success
D:\workspace\wl\study\service\config-service>cd target

D:\workspace\wl\study\service\config-service\target>java -jar config-service-1.0-SNAPSHOT.jar --server.port=8889
2019-03-11 21:54:39.014  INFO 2504 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8889 (http)
2019-03-11 21:54:39.014  INFO 2504 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8889
2019-03-11 21:54:39.017  INFO 2504 --- [           main] com.wl.config.Application                : Started Application in 10.209 seconds (JVM running for 10.624)
2019-03-11 21:54:39.017  INFO 2504 --- [           main] com.wl.config.Application                : application init success

刷新http://localhost:8761/

 两个配置服务已经注册到eureka上了

现在问题在于在其他的spring-boot服务如何加载集群配置服务器上的配置了

新建blog工程

<groupId>com.wl.blog</groupId>
<artifactId>blog</artifactId>
<version>1.0-SNAPSHOT</version>

 pom.xml      需要引用spring-cloud-starter-netflix-eureka-client当然spring-cloud-starter-config这个依赖也是必不可少

<?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.wl.blog</groupId>
  <artifactId>blog</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>blog</name>


  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <daylife-version>1.0-SNAPSHOT</daylife-version>
    <MainClass>com.wl.blog.Application</MainClass>

    <spring-boot-version>1.5.7.RELEASE</spring-boot-version>

    <spring-cloud-starter-config-version>1.4.5.RELEASE</spring-cloud-starter-config-version>

    <spring-cloud-eureka-client-version>1.4.5.RELEASE</spring-cloud-eureka-client-version>

    <slf4j-api-version>1.7.5</slf4j-api-version>

  </properties>

  <dependencies>

    <!-- spring boot -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <version>${spring-boot-version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-redis</artifactId>
      <version>${spring-boot-version}</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-config -->
    <!-- 依赖 spring-web -->
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-config</artifactId>
      <version>${spring-cloud-starter-config-version}</version>
      <exclusions>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-client -->
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
      <version>${spring-cloud-eureka-client-version}</version>
    </dependency>


    <!---日志 -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-api-version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <version>${spring-boot-version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-autoconfigure</artifactId>
      <version>${spring-boot-version}</version>
    </dependency>
  </dependencies>

  <!-- Package as an executable jar -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot-version}</version>
        <configuration>
          <mainClass>${MainClass}</mainClass>
          <layout>JAR</layout>
        </configuration>
        <!-- repackage  生成两个 jar.original -->
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- 指定maven 打包java 版本 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
    <!-- maven  编译打包resource 和 java 目录下所有文件  maven默认资源路径是resources -->
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.*</include>
          <include>*.*</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.*</include>
          <include>*.*</include>
        </includes>
      </resource>
    </resources>
  </build>
</project>

修改bootstrap.properties

spring.application.name=blog
#spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.profile=dev01
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=config-server-client
spring.profiles.active[0]=dev01
eureka.client.serviceUrl.defaultZone=http\://localhost\:8761/eureka/
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true

与单机版的配置主要区别是没有指定spring.cloud.config.uri,但是需要spring.cloud.config.discovery.service-id和spring.cloud.config.discovery.enabled配置

spring.cloud.config.discovery.service-id就是配置服务器的spring.application.name配置对应的名称

启动类

package com.wl.blog;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.core.env.Environment;

/**
 * Created by Administrator on 2019/3/11.
 */
@SpringBootApplication(exclude = {
        DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class             //不使用数据库
},scanBasePackages = "com.wl")
public class Application implements CommandLineRunner{

    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    @Autowired
    private Environment environment;

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(Application.class);
        app.setWebEnvironment(true);
        app.run(args);
        logger.info("application init success");
    }

    @Override
    public void run(String... strings) throws Exception {
        String str = environment.getProperty("application-dev01");
        System.out.println(str);
    }
}

咱们启动两下看看(可能需要多试几次)

"D:\Program Files\Java\jdk1.8.0_181\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59706,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;D:\workspace\wl\study\blog\target\classes;D:\maven\repo\org\springframework\boot\spring-boot-starter-web\1.5.7.RELEASE\spring-boot-starter-web-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter\1.5.7.RELEASE\spring-boot-starter-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter-logging\1.5.7.RELEASE\spring-boot-starter-logging-1.5.7.RELEASE.jar;D:\maven\repo\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\maven\repo\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\maven\repo\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\maven\repo\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\maven\repo\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter-tomcat\1.5.7.RELEASE\spring-boot-starter-tomcat-1.5.7.RELEASE.jar;D:\maven\repo\org\apache\tomcat\embed\tomcat-embed-core\8.5.20\tomcat-embed-core-8.5.20.jar;D:\maven\repo\org\apache\tomcat\embed\tomcat-embed-el\8.5.20\tomcat-embed-el-8.5.20.jar;D:\maven\repo\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.20\tomcat-embed-websocket-8.5.20.jar;D:\maven\repo\org\hibernate\hibernate-validator\5.3.5.Final\hibernate-validator-5.3.5.Final.jar;D:\maven\repo\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\maven\repo\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;D:\maven\repo\com\fasterxml\classmate\1.3.1\classmate-1.3.1.jar;D:\maven\repo\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\maven\repo\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\maven\repo\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\maven\repo\org\springframework\spring-web\4.3.11.RELEASE\spring-web-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-aop\4.3.11.RELEASE\spring-aop-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-beans\4.3.11.RELEASE\spring-beans-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-context\4.3.11.RELEASE\spring-context-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-webmvc\4.3.11.RELEASE\spring-webmvc-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-expression\4.3.11.RELEASE\spring-expression-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter-data-redis\1.5.7.RELEASE\spring-boot-starter-data-redis-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\data\spring-data-redis\1.8.7.RELEASE\spring-data-redis-1.8.7.RELEASE.jar;D:\maven\repo\org\springframework\data\spring-data-keyvalue\1.2.7.RELEASE\spring-data-keyvalue-1.2.7.RELEASE.jar;D:\maven\repo\org\springframework\data\spring-data-commons\1.13.7.RELEASE\spring-data-commons-1.13.7.RELEASE.jar;D:\maven\repo\org\springframework\spring-tx\4.3.11.RELEASE\spring-tx-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-oxm\4.3.11.RELEASE\spring-oxm-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-context-support\4.3.11.RELEASE\spring-context-support-4.3.11.RELEASE.jar;D:\maven\repo\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\maven\repo\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;D:\maven\repo\org\apache\commons\commons-pool2\2.4.2\commons-pool2-2.4.2.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-config\1.4.5.RELEASE\spring-cloud-starter-config-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter\1.3.5.RELEASE\spring-cloud-starter-1.3.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-context\1.3.5.RELEASE\spring-cloud-context-1.3.5.RELEASE.jar;D:\maven\repo\org\springframework\security\spring-security-crypto\4.2.8.RELEASE\spring-security-crypto-4.2.8.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-commons\1.3.5.RELEASE\spring-cloud-commons-1.3.5.RELEASE.jar;D:\maven\repo\org\springframework\security\spring-security-rsa\1.0.3.RELEASE\spring-security-rsa-1.0.3.RELEASE.jar;D:\maven\repo\org\bouncycastle\bcpkix-jdk15on\1.55\bcpkix-jdk15on-1.55.jar;D:\maven\repo\org\bouncycastle\bcprov-jdk15on\1.55\bcprov-jdk15on-1.55.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-config-client\1.4.5.RELEASE\spring-cloud-config-client-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-netflix-eureka-client\1.4.5.RELEASE\spring-cloud-starter-netflix-eureka-client-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-netflix-core\1.4.5.RELEASE\spring-cloud-netflix-core-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-netflix-eureka-client\1.4.5.RELEASE\spring-cloud-netflix-eureka-client-1.4.5.RELEASE.jar;D:\maven\repo\com\netflix\eureka\eureka-client\1.7.2\eureka-client-1.7.2.jar;D:\maven\repo\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\maven\repo\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\maven\repo\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\maven\repo\joda-time\joda-time\2.3\joda-time-2.3.jar;D:\maven\repo\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\maven\repo\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\maven\repo\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\maven\repo\com\google\code\gson\gson\2.1\gson-2.1.jar;D:\maven\repo\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\maven\repo\com\netflix\archaius\archaius-core\0.7.5\archaius-core-0.7.5.jar;D:\maven\repo\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\maven\repo\com\netflix\servo\servo-core\0.10.1\servo-core-0.10.1.jar;D:\maven\repo\com\netflix\servo\servo-internal\0.10.1\servo-internal-0.10.1.jar;D:\maven\repo\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\maven\repo\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\maven\repo\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\maven\repo\org\apache\httpcomponents\httpclient\4.3.4\httpclient-4.3.4.jar;D:\maven\repo\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;D:\maven\repo\commons-codec\commons-codec\1.6\commons-codec-1.6.jar;D:\maven\repo\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\maven\repo\javax\inject\javax.inject\1\javax.inject-1.jar;D:\maven\repo\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\maven\repo\com\netflix\eureka\eureka-core\1.7.2\eureka-core-1.7.2.jar;D:\maven\repo\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar;D:\maven\repo\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\maven\repo\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-netflix-archaius\1.4.5.RELEASE\spring-cloud-starter-netflix-archaius-1.4.5.RELEASE.jar;D:\maven\repo\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;D:\maven\repo\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\maven\repo\com\google\guava\guava\18.0\guava-18.0.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\1.4.5.RELEASE\spring-cloud-starter-netflix-ribbon-1.4.5.RELEASE.jar;D:\maven\repo\com\netflix\ribbon\ribbon\2.2.5\ribbon-2.2.5.jar;D:\maven\repo\com\netflix\ribbon\ribbon-transport\2.2.5\ribbon-transport-2.2.5.jar;D:\maven\repo\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;D:\maven\repo\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;D:\maven\repo\com\netflix\hystrix\hystrix-core\1.4.3\hystrix-core-1.4.3.jar;D:\maven\repo\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;D:\maven\repo\io\netty\netty-codec-http\4.0.27.Final\netty-codec-http-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-codec\4.0.27.Final\netty-codec-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-handler\4.0.27.Final\netty-handler-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-transport-native-epoll\4.0.27.Final\netty-transport-native-epoll-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-common\4.0.27.Final\netty-common-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-buffer\4.0.27.Final\netty-buffer-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-transport\4.0.27.Final\netty-transport-4.0.27.Final.jar;D:\maven\repo\com\netflix\ribbon\ribbon-core\2.2.5\ribbon-core-2.2.5.jar;D:\maven\repo\com\netflix\ribbon\ribbon-httpclient\2.2.5\ribbon-httpclient-2.2.5.jar;D:\maven\repo\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-commons-util\0.1.1\netflix-commons-util-0.1.1.jar;D:\maven\repo\com\netflix\ribbon\ribbon-loadbalancer\2.2.5\ribbon-loadbalancer-2.2.5.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;D:\maven\repo\io\reactivex\rxjava\1.2.0\rxjava-1.2.0.jar;D:\maven\repo\com\netflix\ribbon\ribbon-eureka\2.2.5\ribbon-eureka-2.2.5.jar;D:\maven\repo\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\maven\repo\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;D:\maven\repo\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;D:\maven\repo\org\slf4j\slf4j-api\1.7.5\slf4j-api-1.7.5.jar;D:\maven\repo\org\springframework\spring-core\4.3.11.RELEASE\spring-core-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-autoconfigure\1.5.7.RELEASE\spring-boot-autoconfigure-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot\1.5.7.RELEASE\spring-boot-1.5.7.RELEASE.jar;D:\Program Files\JetBrains\IntelliJ IDEA 2017.1.6\lib\idea_rt.jar" com.wl.blog.Application
Connected to the target VM, address: '127.0.0.1:59706', transport: 'socket'
2019-03-11 22:28:13.921  INFO 3840 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7dfd3c81: startup date [Mon Mar 11 22:28:13 CST 2019]; root of context hierarchy
2019-03-11 22:28:14.248  INFO 3840 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-03-11 22:28:14.284  INFO 3840 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$acac4a37] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-11 22:28:15.558  INFO 3840 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 22:28:15.621  INFO 3840 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2019-03-11 22:28:15.688  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2019-03-11 22:28:15.954  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2019-03-11 22:28:15.954  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2019-03-11 22:28:16.059  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2019-03-11 22:28:16.059  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2019-03-11 22:28:16.247  INFO 3840 --- [           main] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-03-11 22:28:16.311  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2019-03-11 22:28:16.311  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2019-03-11 22:28:16.311  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2019-03-11 22:28:16.311  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Application is null : false
2019-03-11 22:28:16.311  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2019-03-11 22:28:16.311  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2019-03-11 22:28:16.311  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2019-03-11 22:28:16.460  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : The response status is 200
2019-03-11 22:28:16.461  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2019-03-11 22:28:16.463  INFO 3840 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-03-11 22:28:16.466  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1552314496466 with initial instances count: 3

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.7.RELEASE)

2019-03-11 22:28:17.673  INFO 3840 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888/
2019-03-11 22:28:18.910  INFO 3840 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=blog, profiles=[dev01], label=null, version=null, state=null
2019-03-11 22:28:18.910  INFO 3840 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource [name='configService', propertySources=[MapPropertySource {name='file:///D:/workspace/wl/study/config/application-dev01.properties'}, MapPropertySource {name='file:///D:/workspace/wl/study/config/blog.properties'}, MapPropertySource {name='file:///D:/workspace/wl/study/config/application.properties'}]]
2019-03-11 22:28:18.912  WARN 3840 --- [           main] b.c.PropertySourceBootstrapConfiguration : Logging config file location 'classpath:logger/logback-boot.xml' cannot be opened and will be ignored
2019-03-11 22:28:18.913  INFO 3840 --- [           main] com.wl.blog.Application                  : The following profiles are active: dev01
2019-03-11 22:28:18.936  INFO 3840 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@30a7653e: startup date [Mon Mar 11 22:28:18 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@7dfd3c81
2019-03-11 22:28:19.319  INFO 3840 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-03-11 22:28:19.527  INFO 3840 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=7bdccc96-aacf-3021-b0ef-a24247f9e1bc
2019-03-11 22:28:19.537  INFO 3840 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-03-11 22:28:19.578  INFO 3840 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$acac4a37] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-11 22:28:19.816  INFO 3840 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 9002 (http)
2019-03-11 22:28:19.825  INFO 3840 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-03-11 22:28:19.826  INFO 3840 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.20
2019-03-11 22:28:19.938  INFO 3840 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-03-11 22:28:19.938  INFO 3840 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1002 ms
2019-03-11 22:28:20.071  INFO 3840 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2019-03-11 22:28:20.076  INFO 3840 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-03-11 22:28:20.076  INFO 3840 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-03-11 22:28:20.076  INFO 3840 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-03-11 22:28:20.076  INFO 3840 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-03-11 22:28:20.227  WARN 3840 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-03-11 22:28:20.227  INFO 3840 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-03-11 22:28:20.232  WARN 3840 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-03-11 22:28:20.232  INFO 3840 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-03-11 22:28:20.448  INFO 3840 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@30a7653e: startup date [Mon Mar 11 22:28:18 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@7dfd3c81
2019-03-11 22:28:20.508  INFO 3840 --- [           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)
2019-03-11 22:28:20.509  INFO 3840 --- [           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)
2019-03-11 22:28:20.535  INFO 3840 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 22:28:20.535  INFO 3840 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 22:28:20.572  INFO 3840 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 22:28:21.753  INFO 3840 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 22:28:23.074  INFO 3840 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 22:28:23.185  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2019-03-11 22:28:23.186  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Unregistering ...
2019-03-11 22:28:23.191  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_BLOG/localhost:blog - deregister  status: 404
2019-03-11 22:28:23.198  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Completed shut down of DiscoveryClient
2019-03-11 22:28:23.301  INFO 3840 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2019-03-11 22:28:23.309  INFO 3840 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2019-03-11 22:28:23.310  INFO 3840 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'environmentManager' has been autodetected for JMX exposure
2019-03-11 22:28:23.310  INFO 3840 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshScope' has been autodetected for JMX exposure
2019-03-11 22:28:23.312  INFO 3840 --- [           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]
2019-03-11 22:28:23.323  INFO 3840 --- [           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]
2019-03-11 22:28:23.332  INFO 3840 --- [           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=30a7653e,type=ConfigurationPropertiesRebinder]
2019-03-11 22:28:23.359  INFO 3840 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2019-03-11 22:28:23.369  INFO 3840 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2019-03-11 22:28:23.371  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2019-03-11 22:28:23.374  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2019-03-11 22:28:23.374  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2019-03-11 22:28:23.374  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2019-03-11 22:28:23.374  INFO 3840 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2019-03-11 22:28:23.452  INFO 3840 --- [           main] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-03-11 22:28:23.453  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2019-03-11 22:28:23.453  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2019-03-11 22:28:23.453  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2019-03-11 22:28:23.453  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Application is null : false
2019-03-11 22:28:23.453  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2019-03-11 22:28:23.453  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2019-03-11 22:28:23.453  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2019-03-11 22:28:23.458  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : The response status is 200
2019-03-11 22:28:23.458  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2019-03-11 22:28:23.459  INFO 3840 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-03-11 22:28:23.459  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1552314503459 with initial instances count: 3
2019-03-11 22:28:23.461  INFO 3840 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application blog with eureka with status UP
2019-03-11 22:28:23.462  INFO 3840 --- [           main] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1552314503462, current=UP, previous=STARTING]
2019-03-11 22:28:23.463  INFO 3840 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_BLOG/localhost:blog:9002: registering service...
2019-03-11 22:28:23.489  INFO 3840 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_BLOG/localhost:blog:9002 - registration status: 204
2019-03-11 22:28:23.521  INFO 3840 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9002 (http)
2019-03-11 22:28:23.522  INFO 3840 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 9002
application-dev01
2019-03-11 22:28:23.525  INFO 3840 --- [           main] com.wl.blog.Application                  : Started Application in 11.03 seconds (JVM running for 11.454)
2019-03-11 22:28:23.525  INFO 3840 --- [           main] com.wl.blog.Application                  : application init success
"D:\Program Files\Java\jdk1.8.0_181\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59906,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;D:\workspace\wl\study\blog\target\classes;D:\maven\repo\org\springframework\boot\spring-boot-starter-web\1.5.7.RELEASE\spring-boot-starter-web-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter\1.5.7.RELEASE\spring-boot-starter-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter-logging\1.5.7.RELEASE\spring-boot-starter-logging-1.5.7.RELEASE.jar;D:\maven\repo\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\maven\repo\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\maven\repo\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\maven\repo\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\maven\repo\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter-tomcat\1.5.7.RELEASE\spring-boot-starter-tomcat-1.5.7.RELEASE.jar;D:\maven\repo\org\apache\tomcat\embed\tomcat-embed-core\8.5.20\tomcat-embed-core-8.5.20.jar;D:\maven\repo\org\apache\tomcat\embed\tomcat-embed-el\8.5.20\tomcat-embed-el-8.5.20.jar;D:\maven\repo\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.20\tomcat-embed-websocket-8.5.20.jar;D:\maven\repo\org\hibernate\hibernate-validator\5.3.5.Final\hibernate-validator-5.3.5.Final.jar;D:\maven\repo\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\maven\repo\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;D:\maven\repo\com\fasterxml\classmate\1.3.1\classmate-1.3.1.jar;D:\maven\repo\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\maven\repo\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\maven\repo\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\maven\repo\org\springframework\spring-web\4.3.11.RELEASE\spring-web-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-aop\4.3.11.RELEASE\spring-aop-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-beans\4.3.11.RELEASE\spring-beans-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-context\4.3.11.RELEASE\spring-context-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-webmvc\4.3.11.RELEASE\spring-webmvc-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-expression\4.3.11.RELEASE\spring-expression-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-starter-data-redis\1.5.7.RELEASE\spring-boot-starter-data-redis-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\data\spring-data-redis\1.8.7.RELEASE\spring-data-redis-1.8.7.RELEASE.jar;D:\maven\repo\org\springframework\data\spring-data-keyvalue\1.2.7.RELEASE\spring-data-keyvalue-1.2.7.RELEASE.jar;D:\maven\repo\org\springframework\data\spring-data-commons\1.13.7.RELEASE\spring-data-commons-1.13.7.RELEASE.jar;D:\maven\repo\org\springframework\spring-tx\4.3.11.RELEASE\spring-tx-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-oxm\4.3.11.RELEASE\spring-oxm-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\spring-context-support\4.3.11.RELEASE\spring-context-support-4.3.11.RELEASE.jar;D:\maven\repo\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\maven\repo\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;D:\maven\repo\org\apache\commons\commons-pool2\2.4.2\commons-pool2-2.4.2.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-config\1.4.5.RELEASE\spring-cloud-starter-config-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter\1.3.5.RELEASE\spring-cloud-starter-1.3.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-context\1.3.5.RELEASE\spring-cloud-context-1.3.5.RELEASE.jar;D:\maven\repo\org\springframework\security\spring-security-crypto\4.2.8.RELEASE\spring-security-crypto-4.2.8.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-commons\1.3.5.RELEASE\spring-cloud-commons-1.3.5.RELEASE.jar;D:\maven\repo\org\springframework\security\spring-security-rsa\1.0.3.RELEASE\spring-security-rsa-1.0.3.RELEASE.jar;D:\maven\repo\org\bouncycastle\bcpkix-jdk15on\1.55\bcpkix-jdk15on-1.55.jar;D:\maven\repo\org\bouncycastle\bcprov-jdk15on\1.55\bcprov-jdk15on-1.55.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-config-client\1.4.5.RELEASE\spring-cloud-config-client-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-netflix-eureka-client\1.4.5.RELEASE\spring-cloud-starter-netflix-eureka-client-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-netflix-core\1.4.5.RELEASE\spring-cloud-netflix-core-1.4.5.RELEASE.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-netflix-eureka-client\1.4.5.RELEASE\spring-cloud-netflix-eureka-client-1.4.5.RELEASE.jar;D:\maven\repo\com\netflix\eureka\eureka-client\1.7.2\eureka-client-1.7.2.jar;D:\maven\repo\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\maven\repo\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\maven\repo\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\maven\repo\joda-time\joda-time\2.3\joda-time-2.3.jar;D:\maven\repo\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\maven\repo\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\maven\repo\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\maven\repo\com\google\code\gson\gson\2.1\gson-2.1.jar;D:\maven\repo\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\maven\repo\com\netflix\archaius\archaius-core\0.7.5\archaius-core-0.7.5.jar;D:\maven\repo\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\maven\repo\com\netflix\servo\servo-core\0.10.1\servo-core-0.10.1.jar;D:\maven\repo\com\netflix\servo\servo-internal\0.10.1\servo-internal-0.10.1.jar;D:\maven\repo\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\maven\repo\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\maven\repo\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\maven\repo\org\apache\httpcomponents\httpclient\4.3.4\httpclient-4.3.4.jar;D:\maven\repo\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;D:\maven\repo\commons-codec\commons-codec\1.6\commons-codec-1.6.jar;D:\maven\repo\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\maven\repo\javax\inject\javax.inject\1\javax.inject-1.jar;D:\maven\repo\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\maven\repo\com\netflix\eureka\eureka-core\1.7.2\eureka-core-1.7.2.jar;D:\maven\repo\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar;D:\maven\repo\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\maven\repo\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-netflix-archaius\1.4.5.RELEASE\spring-cloud-starter-netflix-archaius-1.4.5.RELEASE.jar;D:\maven\repo\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;D:\maven\repo\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\maven\repo\com\google\guava\guava\18.0\guava-18.0.jar;D:\maven\repo\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\1.4.5.RELEASE\spring-cloud-starter-netflix-ribbon-1.4.5.RELEASE.jar;D:\maven\repo\com\netflix\ribbon\ribbon\2.2.5\ribbon-2.2.5.jar;D:\maven\repo\com\netflix\ribbon\ribbon-transport\2.2.5\ribbon-transport-2.2.5.jar;D:\maven\repo\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;D:\maven\repo\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;D:\maven\repo\com\netflix\hystrix\hystrix-core\1.4.3\hystrix-core-1.4.3.jar;D:\maven\repo\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;D:\maven\repo\io\netty\netty-codec-http\4.0.27.Final\netty-codec-http-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-codec\4.0.27.Final\netty-codec-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-handler\4.0.27.Final\netty-handler-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-transport-native-epoll\4.0.27.Final\netty-transport-native-epoll-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-common\4.0.27.Final\netty-common-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-buffer\4.0.27.Final\netty-buffer-4.0.27.Final.jar;D:\maven\repo\io\netty\netty-transport\4.0.27.Final\netty-transport-4.0.27.Final.jar;D:\maven\repo\com\netflix\ribbon\ribbon-core\2.2.5\ribbon-core-2.2.5.jar;D:\maven\repo\com\netflix\ribbon\ribbon-httpclient\2.2.5\ribbon-httpclient-2.2.5.jar;D:\maven\repo\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-commons-util\0.1.1\netflix-commons-util-0.1.1.jar;D:\maven\repo\com\netflix\ribbon\ribbon-loadbalancer\2.2.5\ribbon-loadbalancer-2.2.5.jar;D:\maven\repo\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;D:\maven\repo\io\reactivex\rxjava\1.2.0\rxjava-1.2.0.jar;D:\maven\repo\com\netflix\ribbon\ribbon-eureka\2.2.5\ribbon-eureka-2.2.5.jar;D:\maven\repo\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\maven\repo\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;D:\maven\repo\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;D:\maven\repo\org\slf4j\slf4j-api\1.7.5\slf4j-api-1.7.5.jar;D:\maven\repo\org\springframework\spring-core\4.3.11.RELEASE\spring-core-4.3.11.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot-autoconfigure\1.5.7.RELEASE\spring-boot-autoconfigure-1.5.7.RELEASE.jar;D:\maven\repo\org\springframework\boot\spring-boot\1.5.7.RELEASE\spring-boot-1.5.7.RELEASE.jar;D:\Program Files\JetBrains\IntelliJ IDEA 2017.1.6\lib\idea_rt.jar" com.wl.blog.Application
Connected to the target VM, address: '127.0.0.1:59906', transport: 'socket'
2019-03-11 22:30:08.195  INFO 11944 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7dfd3c81: startup date [Mon Mar 11 22:30:08 CST 2019]; root of context hierarchy
2019-03-11 22:30:08.510  INFO 11944 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-03-11 22:30:08.544  INFO 11944 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$77fe2c44] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-11 22:30:09.822  INFO 11944 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 22:30:09.891  INFO 11944 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2019-03-11 22:30:09.957  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2019-03-11 22:30:10.225  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2019-03-11 22:30:10.225  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2019-03-11 22:30:10.328  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2019-03-11 22:30:10.328  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2019-03-11 22:30:10.528  INFO 11944 --- [           main] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-03-11 22:30:10.593  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2019-03-11 22:30:10.593  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2019-03-11 22:30:10.593  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2019-03-11 22:30:10.593  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Application is null : false
2019-03-11 22:30:10.593  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2019-03-11 22:30:10.593  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2019-03-11 22:30:10.593  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2019-03-11 22:30:10.748  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : The response status is 200
2019-03-11 22:30:10.749  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2019-03-11 22:30:10.751  INFO 11944 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-03-11 22:30:10.753  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1552314610753 with initial instances count: 4

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.7.RELEASE)

2019-03-11 22:30:11.956  INFO 11944 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8889/
2019-03-11 22:30:13.219  INFO 11944 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=blog, profiles=[dev01], label=null, version=null, state=null
2019-03-11 22:30:13.219  INFO 11944 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource [name='configService', propertySources=[MapPropertySource {name='file:///D:/workspace/wl/study/config/application-dev01.properties'}, MapPropertySource {name='file:///D:/workspace/wl/study/config/blog.properties'}, MapPropertySource {name='file:///D:/workspace/wl/study/config/application.properties'}]]
2019-03-11 22:30:13.221  WARN 11944 --- [           main] b.c.PropertySourceBootstrapConfiguration : Logging config file location 'classpath:logger/logback-boot.xml' cannot be opened and will be ignored
2019-03-11 22:30:13.223  INFO 11944 --- [           main] com.wl.blog.Application                  : The following profiles are active: dev01
2019-03-11 22:30:13.251  INFO 11944 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1b57c345: startup date [Mon Mar 11 22:30:13 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@7dfd3c81
2019-03-11 22:30:13.682  INFO 11944 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-03-11 22:30:13.889  INFO 11944 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=7bdccc96-aacf-3021-b0ef-a24247f9e1bc
2019-03-11 22:30:13.898  INFO 11944 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-03-11 22:30:13.936  INFO 11944 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$77fe2c44] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-11 22:30:14.169  INFO 11944 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 9002 (http)
2019-03-11 22:30:14.178  INFO 11944 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-03-11 22:30:14.179  INFO 11944 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.20
2019-03-11 22:30:14.292  INFO 11944 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-03-11 22:30:14.293  INFO 11944 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1042 ms
2019-03-11 22:30:14.438  INFO 11944 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2019-03-11 22:30:14.442  INFO 11944 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-03-11 22:30:14.443  INFO 11944 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-03-11 22:30:14.443  INFO 11944 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-03-11 22:30:14.443  INFO 11944 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-03-11 22:30:14.585  WARN 11944 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-03-11 22:30:14.585  INFO 11944 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-03-11 22:30:14.590  WARN 11944 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-03-11 22:30:14.590  INFO 11944 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-03-11 22:30:14.818  INFO 11944 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1b57c345: startup date [Mon Mar 11 22:30:13 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@7dfd3c81
2019-03-11 22:30:14.875  INFO 11944 --- [           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)
2019-03-11 22:30:14.876  INFO 11944 --- [           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)
2019-03-11 22:30:14.902  INFO 11944 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 22:30:14.902  INFO 11944 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 22:30:14.935  INFO 11944 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-03-11 22:30:16.110  INFO 11944 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 22:30:17.440  INFO 11944 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-03-11 22:30:17.557  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2019-03-11 22:30:17.557  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Unregistering ...
2019-03-11 22:30:17.563  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_BLOG/localhost:blog - deregister  status: 404
2019-03-11 22:30:17.570  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Completed shut down of DiscoveryClient
2019-03-11 22:30:17.674  INFO 11944 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2019-03-11 22:30:17.681  INFO 11944 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2019-03-11 22:30:17.682  INFO 11944 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'environmentManager' has been autodetected for JMX exposure
2019-03-11 22:30:17.682  INFO 11944 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'refreshScope' has been autodetected for JMX exposure
2019-03-11 22:30:17.684  INFO 11944 --- [           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]
2019-03-11 22:30:17.698  INFO 11944 --- [           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]
2019-03-11 22:30:17.711  INFO 11944 --- [           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=1b57c345,type=ConfigurationPropertiesRebinder]
2019-03-11 22:30:17.744  INFO 11944 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2019-03-11 22:30:17.756  INFO 11944 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2019-03-11 22:30:17.760  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2019-03-11 22:30:17.764  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2019-03-11 22:30:17.764  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2019-03-11 22:30:17.764  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2019-03-11 22:30:17.764  INFO 11944 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2019-03-11 22:30:17.850  INFO 11944 --- [           main] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2019-03-11 22:30:17.850  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2019-03-11 22:30:17.850  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2019-03-11 22:30:17.851  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2019-03-11 22:30:17.851  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Application is null : false
2019-03-11 22:30:17.851  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2019-03-11 22:30:17.851  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2019-03-11 22:30:17.851  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2019-03-11 22:30:17.855  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : The response status is 200
2019-03-11 22:30:17.857  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
2019-03-11 22:30:17.857  INFO 11944 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
2019-03-11 22:30:17.858  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1552314617858 with initial instances count: 4
2019-03-11 22:30:17.859  INFO 11944 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application blog with eureka with status UP
2019-03-11 22:30:17.859  INFO 11944 --- [           main] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1552314617859, current=UP, previous=STARTING]
2019-03-11 22:30:17.861  INFO 11944 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_BLOG/localhost:blog:9002: registering service...
2019-03-11 22:30:17.887  INFO 11944 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_BLOG/localhost:blog:9002 - registration status: 204
2019-03-11 22:30:17.913  INFO 11944 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9002 (http)
2019-03-11 22:30:17.913  INFO 11944 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 9002
application-dev01
2019-03-11 22:30:17.916  INFO 11944 --- [           main] com.wl.blog.Application                  : Started Application in 11.153 seconds (JVM running for 11.61)
2019-03-11 22:30:17.917  INFO 11944 --- [           main] com.wl.blog.Application                  : application init success

可以看到分别加载的是8888端口的配置服务器和8889端口的配置服务器

都成功的加载了配置

实际开发和生产中配置集群服务器是用的很少的,一般单机的配置服务器就已经满足需求,没有必要使用配置服务器集群 

猜你喜欢

转载自blog.csdn.net/name_is_wl/article/details/88410613