1、报错如下图:
6、再次启动spingboot应用,查看数据库,员工和部门表已经生成,如下图:
***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [Bindable@69cac930 type = java.util.List, value = 'provided', annotations = array[[empty]]] failed:
Property: spring.datasource.schema[0].class-path
Value: sql/department.sql
Origin: class path resource [application.yml]:28:21
Reason: The elements [spring.datasource.schema[0].class-path,spring.datasource.schema[1].class-path] were left unbound.
Property: spring.datasource.schema[1].class-path
Value: sql/employee.sql
Origin: class path resource [application.yml]:29:21
Reason: The elements [spring.datasource.schema[0].class-path,spring.datasource.schema[1].class-path] were left unbound.
Action:
Update your application's configuration
Process finished with exit code 1
2、解决方式:
pom.xml文件中的schema配置写错了,如下图中:
1)去掉class和path中间的中横线; 2)去掉冒号和sql中间的空格; 正确写法如下:
schema:
- classpath:sql/department.sql
- classpath:sql/employee.sql
3、启动成功后的效果图如下:
