nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind p

如果直接在右上方启动SpringBoot并没有使用tomcat容器,项目启动后就直接关闭了
出现如下:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-10-22 21:24:43.114 ERROR 6904 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Binding to target [Bindable@6754ef00 type = java.util.List<java.lang.String>, value = 'provided', annotations = array<Annotation>[[empty]]] failed:

    Property: spring.datasource.schema[0].classpath
    Value: sql/department.sql
    Origin: class path resource [application.yml]:25:19
    Reason: The elements [spring.datasource.schema[0].classpath,spring.datasource.schema[1].classpath] were left unbound.
    Property: spring.datasource.schema[1].classpath
    Value: sql/employee.sql
    Origin: class path resource [application.yml]:26:19
    Reason: The elements [spring.datasource.schema[0].classpath,spring.datasource.schema[1].classpath] were left unbound.

Action:

Update your application's configuration


Process finished with exit code 1

在SpringBoot的测试类中启动的话
报如下错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'druid' defined in class path resource [com/atguigu/springbootjdbcmybatis/config/DruidConfig.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Could not bind properties to 'DataSourceProperties' : prefix=spring.datasource, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.datasource.schema' to java.util.List<java.lang.String>

最后解决办法:
删除application.yml文件中的

schema:
     - classpath: sql/department.sql
     - classpath: sql/employee.sql

最后正常启动

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
Unable to start web server; nested exception is org.springframework.context.ApplicationContextException 是一个SpringBoot项目启动报错,表示无法启动Web服务器。这个错误通常是由于缺少ServletWebServerFactory bean引起的。解决这个问题的一种方法是手动添加spring-boot-starter-tomcat依赖项,例如: ``` <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <version>2.1.5.RELEASE</version> </dependency> ``` 这个依赖项将提供所需的ServletWebServerFactory bean,以解决启动错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Unable to start web server... nested exception is org.springframework.context.ApplicationContextExcept](https://blog.csdn.net/qq_42875600/article/details/130176394)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatgptT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [解决Handler processing failed; nested exception is java.lang.NoClassDefFoundError_kmode exception](https://download.csdn.net/download/lj_70596/14122358)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatgptT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值