使用.properties的Spring数据源bean配置

时间:2022-08-15 19:40:36

Until now I'v worked with simple spring project and my Datasource bean was configured through the xml file, now I am using the Spring Boot, and there isnt an xml file.

到目前为止,我使用简单的spring项目,我的Datasource bean是通过xml文件配置的,现在我使用的是Spring Boot,并且没有xml文件。

The question is - where do i configure the Datasource bean now? at the application.properties file? (with spring.datasource.driver-class-name spring.datasource.url for example) or somewhere else?

问题是 - 我现在在哪里配置数据源bean?在application.properties文件? (例如spring.datasource.driver-class-name spring.datasource.url)或其他地方?

Thx in advance!

Thx提前!

1 个解决方案

#1


1  

Yes in Spring boot datasource configuration happen on application.properties file ideally. Here is the reference.

是的,Spring引导数据源配置理想地发生在application.properties文件中。这是参考。

#1


1  

Yes in Spring boot datasource configuration happen on application.properties file ideally. Here is the reference.

是的,Spring引导数据源配置理想地发生在application.properties文件中。这是参考。