Spring Boot spring.datasource.data when using a data file can not be found

SQL requires the use of import file, it has been placed to resources \ data-trans.sql the following.

But at configuration time configuration:

spring.datasource.data=data-trans.sql

Show this SQL database file can not be found.

Wrong information:

Property spring.datasource.data with value 'ServletContext resource [/data-trans.sql]' is invalid: The specified resource does not exist.


You need to

spring.datasource.data = file path data-trans.sql modify configuration parameters:

spring.datasource.data=classpath:data-trans.sql

or

spring.datasource.data=classpath:/data-trans.sql

All OK, this tells Spring Boot main load path of the data file.

https://www.cwiki.us/display/SpringBootZH/questions/57938806

Guess you like

Origin www.cnblogs.com/huyuchengus/p/12636158.html