报错:问题集中在"${my.content}"占位符无法被解析,注入不识别。
结果发现git仓库中的wollo.yml文件的内容格式不对!!!2024-09-30 11:31:00.440 INFO 5660 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2024-09-30 11:31:02.846 INFO 5660 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=wollo, profiles=[default], label=master, version=a09e8244ac1ee954a30bc03bedcfed6003754ad6, state=null
2024-09-30 11:31:02.850 INFO 5660 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-https://gitee.com/liutong1217/config-test01.git/wollo.yml'}]
2024-09-30 11:31:02.856 INFO 5660 --- [ main] com.wollo.StudentApplication : No active profile set, falling back to default profiles: default
2024-09-30 11:31:04.755 INFO 5660 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=59d06a89-376b-3d13-a331-59db739e353c
2024-09-30 11:31:05.358 INFO 5660 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2024-09-30 11:31:05.377 INFO 5660 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-09-30 11:31:05.377 INFO 5660 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
2024-09-30 11:31:05.380 INFO 5660 --- [ main] o.a.catalina.core.AprLifecycleListener : Loaded Apache Tomcat Native library [1.2.36] using APR version [1.7.2].
2024-09-30 11:31:05.380 INFO 5660 --- [ main] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2024-09-30 11:31:05.380 INFO 5660 --- [ main] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2024-09-30 11:31:05.389 INFO 5660 --- [ main] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1t 7 Feb 2023]
2024-09-30 11:31:05.662 INFO 5660 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-09-30 11:31:05.662 INFO 5660 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2778 ms
2024-09-30 11:31:05.781 WARN 5660 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'my.content' in value "${my.content}"
2024-09-30 11:31:05.782 INFO 5660 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2024-09-30 11:31:05.801 INFO 5660 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-09-30 11:31:05.845 ERROR 5660 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'my.content' in value "${my.content}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
修改后:
少加个空格,啊啊啊啊啊!