SpringBoot报错:org.springframework.boot.context.properties.bind.UnboundConfigurationPropertiesException: The elements [spring.datasource.schema[0].classpath,spring.datasource.schema[1].classpath] were left unbound.
at springboot06datamybatis.Springboot06DataMybatisApplication.main(Springboot06DataMybatisApplication.java:10) [classes/:na]
Caused by: org.springframework.boot.context.properties.bind.UnboundConfigurationPropertiesException: The elements [spring.datasource.schema[0].classpath,spring.datasource.schema[1].classpath] were left unbound.
at org.springframework.boot.context.properties.bind.IndexedElementsBinder.assertNoUnboundChildren(IndexedElementsBinder.java:136) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
......................
2019-08-29 10:41:06.108 ERROR 4720 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [Bindable@128bcd5 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]:32:20
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]:33:20
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
原因:
原来是我把schema下面多写了一个空格,如图
对比正确写法显示如下:
解决办法:
schema:
# 一定要注意classpath:后面没有空格
- classpath:sql/department.sql
- classpath:sql/employee.sql