No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]错误的一个可能原因

在启动springboot项目时报错,具体如下:

s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@12f9f896: startup date [Thu Dec 12 11:41:58 CST 2019]; root of context hierarchy
2019-12-12 11:41:59.671  INFO 5348 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-12-12 11:41:59.729  INFO 5348 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$9203708e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           佛祖保佑        永无BUG
2019-12-12 11:42:01.092  INFO 5348 --- [           main] c.s.EurekaServerApplication              : No active profile set, falling back to default profiles: default
2019-12-12 11:42:01.120  INFO 5348 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@78b293a: startup date [Thu Dec 12 11:42:01 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@12f9f896
2019-12-12 11:42:03.864  INFO 5348 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=ba1ca2fb-f7e5-3d23-8dda-538abb443650
2019-12-12 11:42:03.910  INFO 5348 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-12-12 11:42:04.272  INFO 5348 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$9203708e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-12-12 11:42:05.586  INFO 5348 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8761 (http)
2019-12-12 11:42:05.747  INFO 5348 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-12-12 11:42:05.748  INFO 5348 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.37
2019-12-12 11:42:05.757  INFO 5348 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [F:\environment\java\java1.8\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;E:\ImageMagick-7.0.1-Q16;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;F:\environment\apache-maven-3.5.3\bin;C:\WINDOWS\System32\OpenSSH\;E:\workSoftware\SVN\bin;F:\environment\Python27;F:\environment\gradle-4.10.3\bin;E:\workSoftware\Git\cmd;F:\environment\java\java1.8\jre\bin;F:\environment\java\java1.8\bin;C:\Users\wzj\AppData\Local\Microsoft\WindowsApps;F:\environment\java\jdk1.8\bin;F:\environment\java\jdk1.8\jre\bin;;.]
2019-12-12 11:42:06.391  INFO 5348 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-12-12 11:42:06.392  INFO 5348 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5272 ms
2019-12-12 11:42:06.960  WARN 5348 --- [ost-startStop-1] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-12-12 11:42:06.961  INFO 5348 --- [ost-startStop-1] 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-12-12 11:42:07.037  INFO 5348 --- [ost-startStop-1] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@5d27dbf1
2019-12-12 11:42:07.363 ERROR 5348 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'org.springframework.cloud.netflix.eureka.server.EurekaServerAutoConfiguration': Unsatisfied dependency expressed through field 'eurekaServerConfig'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaServerConfig' defined in class path resource [org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration$EurekaServerConfigBeanConfiguration.class]: Unsatisfied dependency expressed through method 'eurekaServerConfig' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'eurekaClientConfigBean': Could not bind properties to 'EurekaClientConfigBean' : prefix=eureka.client, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'eureka.client.service-url' to java.util.Map<java.lang.String, java.lang.String>
2019-12-12 11:42:07.519  INFO 5348 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-12-12 11:42:07.605  WARN 5348 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2019-12-12 11:42:07.625  INFO 5348 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-12-12 11:42:07.636 ERROR 5348 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'eureka.client.service-url' to java.util.Map<java.lang.String, java.lang.String>:

    Reason: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]

Action:

Update your application's configuration

Disconnected from the target VM, address: '127.0.0.1:50561', transport: 'socket'

Process finished with exit code 1

从报错提示来看,说我的配置有问题,更新应用配置“Update your application's configuration”,于是我就去看配置文件了,发现有个配置冒号后少个空格

    字体颜色都不对了

把空格加上后,启动成功,问题解决!

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐