微服务A读配置中心报Could not locate PropertySource错误
项目场景:
SpringCloud 搭建之微服务A通过配置中心(微服务)读取本地git仓库的配置文件microservice-a.properties
问题描述:
配置中心微服务config-server启动成后,在启动微服务A时,报如下错误:
"C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\Program Files\IntelliJ IDEA 2020.1\lib\idea_rt.jar=50402:D:\Program Files\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\java\jdk1.8.0_202\jre\lib\charsets.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\deploy.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\access-bridge-64.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\cldrdata.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\dnsns.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\jaccess.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\jfxrt.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\localedata.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\nashorn.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\sunec.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\sunjce_provider.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\sunmscapi.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\sunpkcs11.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\ext\zipfs.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\javaws.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\jce.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\jfr.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\jfxswt.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\jsse.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\management-agent.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\plugin.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\resources.jar;C:\Program Files\java\jdk1.8.0_202\jre\lib\rt.jar;D:\workspace\SpringCloud\microservice-a\target\classes;D:\repository\SpringBoot\org\springframework\boot\spring-boot-starter-web\2.3.0.RELEASE\spring-boot-starter-web-2.3.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-starter\2.3.0.RELEASE\spring-boot-starter-2.3.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot\2.3.0.RELEASE\spring-boot-2.3.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-autoconfigure\2.3.0.RELEASE\spring-boot-autoconfigure-2.3.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-starter-logging\2.3.0.RELEASE\spring-boot-starter-logging-2.3.0.RELEASE.jar;D:\repository\SpringBoot\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\repository\SpringBoot\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\repository\SpringBoot\org\apache\logging\log4j\log4j-to-slf4j\2.13.2\log4j-to-slf4j-2.13.2.jar;D:\repository\SpringBoot\org\apache\logging\log4j\log4j-api\2.13.2\log4j-api-2.13.2.jar;D:\repository\SpringBoot\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\repository\SpringBoot\org\springframework\spring-core\5.2.6.RELEASE\spring-core-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\springframework\spring-jcl\5.2.6.RELEASE\spring-jcl-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-starter-json\2.3.0.RELEASE\spring-boot-starter-json-2.3.0.RELEASE.jar;D:\repository\SpringBoot\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.0\jackson-datatype-jdk8-2.11.0.jar;D:\repository\SpringBoot\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.0\jackson-datatype-jsr310-2.11.0.jar;D:\repository\SpringBoot\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.0\jackson-module-parameter-names-2.11.0.jar;D:\repository\SpringBoot\org\springframework\spring-web\5.2.6.RELEASE\spring-web-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\springframework\spring-beans\5.2.6.RELEASE\spring-beans-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\springframework\spring-webmvc\5.2.6.RELEASE\spring-webmvc-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\springframework\spring-context\5.2.6.RELEASE\spring-context-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\springframework\spring-expression\5.2.6.RELEASE\spring-expression-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-starter-tomcat\2.3.0.RELEASE\spring-boot-starter-tomcat-2.3.0.RELEASE.jar;D:\repository\SpringBoot\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\repository\SpringBoot\org\apache\tomcat\embed\tomcat-embed-core\9.0.35\tomcat-embed-core-9.0.35.jar;D:\repository\SpringBoot\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\repository\SpringBoot\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.35\tomcat-embed-websocket-9.0.35.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-starter-security\2.3.0.RELEASE\spring-boot-starter-security-2.3.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\spring-aop\5.2.6.RELEASE\spring-aop-5.2.6.RELEASE.jar;D:\repository\SpringBoot\org\springframework\security\spring-security-config\5.3.2.RELEASE\spring-security-config-5.3.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\security\spring-security-core\5.3.2.RELEASE\spring-security-core-5.3.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\security\spring-security-web\5.3.2.RELEASE\spring-security-web-5.3.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-starter-actuator\2.3.0.RELEASE\spring-boot-starter-actuator-2.3.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-actuator-autoconfigure\2.3.0.RELEASE\spring-boot-actuator-autoconfigure-2.3.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\boot\spring-boot-actuator\2.3.0.RELEASE\spring-boot-actuator-2.3.0.RELEASE.jar;D:\repository\SpringBoot\io\micrometer\micrometer-core\1.5.1\micrometer-core-1.5.1.jar;D:\repository\SpringBoot\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;D:\repository\SpringBoot\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;D:\repository\SpringBoot\io\springfox\springfox-boot-starter\3.0.0\springfox-boot-starter-3.0.0.jar;D:\repository\SpringBoot\io\springfox\springfox-oas\3.0.0\springfox-oas-3.0.0.jar;D:\repository\SpringBoot\io\swagger\core\v3\swagger-annotations\2.1.2\swagger-annotations-2.1.2.jar;D:\repository\SpringBoot\io\swagger\core\v3\swagger-models\2.1.2\swagger-models-2.1.2.jar;D:\repository\SpringBoot\io\springfox\springfox-spi\3.0.0\springfox-spi-3.0.0.jar;D:\repository\SpringBoot\io\springfox\springfox-schema\3.0.0\springfox-schema-3.0.0.jar;D:\repository\SpringBoot\io\springfox\springfox-core\3.0.0\springfox-core-3.0.0.jar;D:\repository\SpringBoot\net\bytebuddy\byte-buddy\1.10.10\byte-buddy-1.10.10.jar;D:\repository\SpringBoot\io\springfox\springfox-spring-web\3.0.0\springfox-spring-web-3.0.0.jar;D:\repository\SpringBoot\io\github\classgraph\classgraph\4.8.83\classgraph-4.8.83.jar;D:\repository\SpringBoot\io\springfox\springfox-spring-webmvc\3.0.0\springfox-spring-webmvc-3.0.0.jar;D:\repository\SpringBoot\io\springfox\springfox-spring-webflux\3.0.0\springfox-spring-webflux-3.0.0.jar;D:\repository\SpringBoot\io\springfox\springfox-swagger-common\3.0.0\springfox-swagger-common-3.0.0.jar;D:\repository\SpringBoot\org\mapstruct\mapstruct\1.3.1.Final\mapstruct-1.3.1.Final.jar;D:\repository\SpringBoot\io\springfox\springfox-data-rest\3.0.0\springfox-data-rest-3.0.0.jar;D:\repository\SpringBoot\io\springfox\springfox-bean-validators\3.0.0\springfox-bean-validators-3.0.0.jar;D:\repository\SpringBoot\io\springfox\springfox-swagger2\3.0.0\springfox-swagger2-3.0.0.jar;D:\repository\SpringBoot\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar;D:\repository\SpringBoot\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar;D:\repository\SpringBoot\io\springfox\springfox-swagger-ui\3.0.0\springfox-swagger-ui-3.0.0.jar;D:\repository\SpringBoot\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;D:\repository\SpringBoot\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\repository\SpringBoot\org\springframework\plugin\spring-plugin-core\2.0.0.RELEASE\spring-plugin-core-2.0.0.RELEASE.jar;D:\repository\SpringBoot\org\springframework\plugin\spring-plugin-metadata\2.0.0.RELEASE\spring-plugin-metadata-2.0.0.RELEASE.jar;D:\repository\SpringBoot\org\apache\commons\commons-lang3\3.11\commons-lang3-3.11.jar;D:\repository\SpringBoot\org\springframework\cloud\spring-cloud-starter-config\2.2.2.RELEASE\spring-cloud-starter-config-2.2.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\cloud\spring-cloud-starter\2.2.2.RELEASE\spring-cloud-starter-2.2.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\cloud\spring-cloud-context\2.2.2.RELEASE\spring-cloud-context-2.2.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\security\spring-security-crypto\5.3.2.RELEASE\spring-security-crypto-5.3.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\cloud\spring-cloud-commons\2.2.2.RELEASE\spring-cloud-commons-2.2.2.RELEASE.jar;D:\repository\SpringBoot\org\springframework\security\spring-security-rsa\1.0.9.RELEASE\spring-security-rsa-1.0.9.RELEASE.jar;D:\repository\SpringBoot\org\bouncycastle\bcpkix-jdk15on\1.64\bcpkix-jdk15on-1.64.jar;D:\repository\SpringBoot\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;D:\repository\SpringBoot\org\springframework\cloud\spring-cloud-config-client\2.2.2.RELEASE\spring-cloud-config-client-2.2.2.RELEASE.jar;D:\repository\SpringBoot\com\fasterxml\jackson\core\jackson-annotations\2.11.0\jackson-annotations-2.11.0.jar;D:\repository\SpringBoot\com\fasterxml\jackson\core\jackson-databind\2.11.0\jackson-databind-2.11.0.jar;D:\repository\SpringBoot\com\fasterxml\jackson\core\jackson-core\2.11.0\jackson-core-2.11.0.jar" com.dzy.springcloud.microservicea.MicroserviceAApplication
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.0.RELEASE)
2021-02-14 21:52:38.417 INFO 9628 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2021-02-14 21:52:38.593 WARN 9628 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.cloud.config.environment.Environment] and content type [text/html;charset=UTF-8]
2021-02-14 21:52:38.595 INFO 9628 --- [ main] c.d.s.m.MicroserviceAApplication : No active profile set, falling back to default profiles: default
2021-02-14 21:52:39.524 INFO 9628 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=20251c2a-5be0-3cd3-b2c5-4fa35ecd32b1
2021-02-14 21:52:39.741 INFO 9628 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-02-14 21:52:39.746 INFO 9628 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-02-14 21:52:39.746 INFO 9628 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.35]
2021-02-14 21:52:39.842 INFO 9628 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-02-14 21:52:39.842 INFO 9628 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1203 ms
2021-02-14 21:52:40.002 WARN 9628 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messagesController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'application.message' in value "${application.message}"
2021-02-14 21:52:40.004 INFO 9628 ---