您当前的位置: 首页 >  小志的博客 Java

Binding to target [Bindable@69cac930 type = java.util.Listjava.lang.String, value = 'provided', an

小志的博客 发布时间:2019-11-11 17:11:49 ,浏览量:2

1、报错如下图:

***************************
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、启动成功后的效果图如下:

4、启动成功后,数据库表中没有创建表,如下图:

5、springboot2.0x 执行schema.sql脚本注意要加上一个配置:spring.datasource.initialization-mode=always

6、再次启动spingboot应用,查看数据库,员工和部门表已经生成,如下图:

关注
打赏
查看更多评论

小志的博客

暂无认证

  • 2浏览

    0关注

    1100博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录