Java 具有.properties的Spring数据源bean配置
直到现在,我一直在使用SimpleSpring项目,我的数据源bean是通过xml文件配置的,现在我使用的是spring引导,没有xml文件 问题是-我现在在哪里配置数据源bean?在application.properties文件中?(使用Java 具有.properties的Spring数据源bean配置,java,spring,spring-mvc,Java,Spring,Spring Mvc,直到现在,我一直在使用SimpleSpring项目,我的数据源bean是通过xml文件配置的,现在我使用的是spring引导,没有xml文件 问题是-我现在在哪里配置数据源bean?在application.properties文件中?(使用spring.datasource.driver-class-name 例如spring.datasource.url)还是其他地方 提前谢谢 是的,在Spring boot数据源配置中,理想情况下在application.properties文件上进行。
spring.datasource.driver-class-name
例如spring.datasource.url
)还是其他地方
提前谢谢 是的,在Spring boot数据源配置中,理想情况下在application.properties文件上进行。
是引用。这意味着我不需要创建bean,而是将其传递给application.properties,就这样?因为我使用的是JdbcTamplate bean,并且我在其中设置了数据源,所以现在如何将数据源传递给JdbcTamplate bean?您仍然应该能够像以前一样自动连接JdbcTemplate。springboot将负责数据源bean的初始化。