简体   繁体   中英

Getting datasource from tomcat context.xml instead of application.properties

I have a question about deploying a springboot app. Is it possible to get the data source settings from tomcat context.xml resources instead of the application.properties file?

In this project, I already have a war deployed in tomcat and it uses the data source properties from context .xml of tomcat (it is maven project it and it uses hibernate to access the database).

I'd like to do the same thing but using springboot.

You can use the jndi name as you use now like this in spring boot:

spring.datasource.jndi-name=java:comp/env/jdbc/mydb

that part is the actual name

jdbc/mydb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM