SpringBoot 2.x version of the new integrated jdbc execute SQL file failed to build the table without an error

Overview of issues

When integrated with SpringBoot JDBC somehow found a failure to build the table
hit the breakpoint and then found the bottom have to execute
named sql file is also in accordance with the requirements of the results to find for a long time could not find a reason

Solution

In Spring2.x the new version to be executed sql configuration file must spring.datasource.initialization-mode=alwaysrepresent always perform initialization

spring:
  datasource:
    initialization-mode: always

Otherwise, the default initialization embedded data source only and does not initialize all data sources and thus need to manually specify

Underlying code:
Here Insert Picture Description
Here Insert Picture Description
In the new version of the Spring2.x only need to configure this property in the low version so no need to

This is a pit leave a record


Published 174 original articles · won praise 5 · Views 240,000 +

Guess you like

Origin blog.csdn.net/Piconjo/article/details/105054250