It is said in Spring javadoc article about DriverManagerDataSource
class, that this class is very simple and that it is recommended
to use a JNDI DataSource provided by the container. Such a
DataSource
can be exposed as aDataSource
bean in a Spring ApplicationContext viaJndiObjectFactoryBean
The question is: how to accomplish this?
For example if I wish to have DataSource bean to access my custo mysql database, what I require then? What to write in context configuration etc?
I found this solution very helpful in a clean way to remove xml configuration entirely.
Please check this db configuration using JNDI and spring framework. http://www.unotions.com/design/how-to-create-oracleothersql-db-configuration-using-spring-and-maven/
By this article, it explain how easy to create a db confguration based on database jndi(db/test) configuration. once you are done with configuration then all the db repositories are loaded using this jndi. I did find useful. If @Pierre has issue with this then let me know. It's complete solution to write db configuration.
Another feature: instead of of server.xml, you can add "Resource" tag in
your_application/META-INF/Context.xml (according to tomcat docs) like this: