GVKun编程网logo

SpringBoot 升级报错:Failed to bind properties under ''logging.level''(springboot failed to determine)

22

本文将介绍SpringBoot升级报错:Failedtobindpropertiesunder''logging.level''的详细情况,特别是关于springbootfailedtodetermi

本文将介绍SpringBoot 升级报错:Failed to bind properties under ''logging.level''的详细情况,特别是关于springboot failed to determine的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于Failed to bind properties under ''logging.level'' to java.util.Map的知识。

本文目录一览:

SpringBoot 升级报错:Failed to bind properties under ''logging.level''(springboot failed to determine)

SpringBoot 升级报错:Failed to bind properties under ''logging.level''(springboot failed to determine)

错误详细信息:

org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under ''logging.level'' to java.util.Map<java.lang.String, java.lang.String>
    at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:250) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:226) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:210) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:166) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.logging.LoggingApplicationListener.setLogLevels(LoggingApplicationListener.java:307) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.logging.LoggingApplicationListener.initializeFinalLoggingLevels(LoggingApplicationListener.java:290) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:238) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:173) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.0.11.RELEASE.jar:5.0.11.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.0.11.RELEASE.jar:5.0.11.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.0.11.RELEASE.jar:5.0.11.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) ~[spring-context-5.0.11.RELEASE.jar:5.0.11.RELEASE]
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:338) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:297) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at com.acs.springboot.AcsAdminApplication.main(AcsAdminApplication.java:20) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.7.RELEASE.jar:2.0.7.RELEASE]
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]
    at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321) ~[spring-core-5.0.11.RELEASE.jar:5.0.11.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194) ~[spring-core-5.0.11.RELEASE.jar:5.0.11.RELEASE]
    at org.springframework.boot.context.properties.bind.BindConverter$CompositeConversionService.convert(BindConverter.java:162) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:96) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:88) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.MapBinder.bindAggregate(MapBinder.java:67) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.AggregateBinder.bind(AggregateBinder.java:58) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindAggregate$2(Binder.java:305) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:441) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder$Context.access$100(Binder.java:381) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bindAggregate(Binder.java:304) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:262) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    ... 21 common frames omitted

抓住关键信息:

Failed to bind properties under ''logging.level''

错误产生背景:
SpringBoot1.5.9 升级为 2.0.7 版本。

错误原因分析:
是因为 SpringBoot2.0 以上版本日志需要指定包路径才行。

解决办法 (修改 application.yml 配置文件):

原文件关键内容如下:

logging:
  level: warn

将其改为 (指定包路径):

logging:
   com.blog.springboot: WARN

com.blog.springboot 是我个人博客的启动类,你们可以将其改为你自己的即可。
最后问题迎刃而解。

Failed to bind properties under ''logging.level'' to java.util.Map<java.lang.String, jav...

Failed to bind properties under ''logging.level'' to java.util.Map
org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under ''logging.level'' to java.util.Map<java.lang.String, java.lang.String>
    at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:242)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:218)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:202)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:172)
    at org.springframework.boot.context.logging.LoggingApplicationListener.setLogLevels(LoggingApplicationListener.java:338)
    at org.springframework.boot.context.logging.LoggingApplicationListener.initializeFinalLoggingLevels(LoggingApplicationListener.java:314)
    at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:265)
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:226)
    at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:203)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
    at com.example.seller.SellerApplication.main(SellerApplication.java:10)
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]
    at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321)
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194)
    at org.springframework.boot.context.properties.bind.BindConverter$CompositeConversionService.convert(BindConverter.java:170)
    at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:96)
    at org.springframework.boot.context.properties.bind.BindConverter.convert(BindConverter.java:88)
    at org.springframework.boot.context.properties.bind.MapBinder.bindAggregate(MapBinder.java:64)
    at org.springframework.boot.context.properties.bind.AggregateBinder.bind(AggregateBinder.java:56)
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindAggregate$2(Binder.java:293)
    at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:429)
    at org.springframework.boot.context.properties.bind.Binder$Context.access$100(Binder.java:372)
    at org.springframework.boot.context.properties.bind.Binder.bindAggregate(Binder.java:293)
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:254)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:214)
    ... 18 common frames omitted

项目初始化,使用 logback 进行管理项目日志的时候,直接启动就会报错为如上所示:

只需要在.yml 配置文件中,添加如下的配置:

#logback配置
logging:
  pattern:
    console: ''%d -%msg%n''
  path: D:/data/log/seller.log
  level:
    root: debug

 

Failed to bind properties under ''security.oauth2.client.client-id'' to java.lang.String:

Failed to bind properties under ''security.oauth2.client.client-id'' to java.lang.String:

高春辉、王春生、朱峰:关于开源创业的 15 件小事

请教一下, 我们重构了包名、项目名称

不过启动的时候报这个错误 。。排查了好久 没有解决 请作者指导一下 谢谢了

Failed to bind properties under ''spring.datasource'' to javax.sql.DataSource

Failed to bind properties under ''spring.datasource'' to javax.sql.DataSource

原文转载至:https://blog.csdn.net/xingkongtianma01/article/details/81624313

网上查了下,没有找打相关的报错解决办法,所以在解决问题后,整理到网上,帮助有需要的朋友。

 

springboot 整合 druid 时,引入了 druid 的数据源,在配置文件 application.yml 中配置了相关配置

initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
# 配置监控统计拦截的 filters,去掉后监控界面 sql 无法统计,''wall'' 用于防火墙
filters: stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize: 20
useGlobalDataSourceStat: true
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
也作了相关配置 DruidConfig.class

@Configuration
public class DruidConfig {

@ConfigurationProperties(prefix = "spring.datasource")
@Bean
public DataSource druid() {
return new DruidDataSource();
}

// 配置 Druid 的监控
// 1、配置一个管理后台的 Servlet
@Bean
public ServletRegistrationBean statViewServlet() {
ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
Map<String, String> initParams = new HashMap<>();

initParams.put("loginUsername", "admin");
initParams.put("loginPassword", "123456");
initParams.put ("allow", "");// 默认就是允许所有访问
initParams.put("deny", "10.18.172.124");

bean.setInitParameters(initParams);
return bean;
}

// 2、配置一个 web 监控的 filter
@Bean
public FilterRegistrationBean webStatFilter() {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new WebStatFilter());

Map<String, String> initParams = new HashMap<>();
initParams.put("exclusions", "*.js,*.css,/druid/*");

bean.setInitParameters(initParams);

bean.setUrlPatterns(Arrays.asList("/*"));

return bean;
}
}
但是在启动时报错:

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

Description:

Failed to bind properties under ''spring.datasource'' to javax.sql.DataSource:

    Property: spring.datasource.filters
    Value: stat,wall,log4j
    Origin: class path resource [application.yml]:24:14
    Reason: org.apache.log4j.Logger

Action:

Update your application''s configuration

 

根据报错提示在配置文件的 24 行,查看配置文件,该行代码是     filters: stat,wall,log4j

看报错原因 Reason: org.apache.log4j.Logger,于是猜想少了 log4j 的相关依赖,在 pom 中引入相关依赖

<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
再次启动,成功!
————————————————
版权声明:本文为 CSDN 博主「Peter-OK」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xingkongtianma01/article/details/81624313

Failed to bind properties under ''spring.datasource'' to javax.sql.DataSource:

Failed to bind properties under ''spring.datasource'' to javax.sql.DataSource:

Springboot 在更换数据源的为 druid 的时候,报错:

Description:

Failed to bind properties under ''spring.datasource'' to javax.sql.DataSource:

Property: spring.datasource.filters
Value: stat,wall,log4j
Origin: class path resource [application.yml]:22:14
Reason: org.apache.log4j.Logger

Action:

Update your application''s configuration

 


原因是没有引入 log4j

<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

 


ok , 再次启动即可成功。
————————————————
版权声明:本文为 CSDN 博主「new_buff_007」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/new_buff_007/article/details/90343935

关于SpringBoot 升级报错:Failed to bind properties under ''logging.level''springboot failed to determine的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Failed to bind properties under ''logging.level'' to java.util.Map的相关信息,请在本站寻找。

本文标签: