jeudi 26 mars 2015

How to bind a JDBC datasource to JNDI context "java:comp/env/jdbc" when not to use web.xml

How to bind a JDBC datasource to JNDI context java:comp/env/jdbc only using code-based approach.


I want to use only org.springframework.web.context.AbstractContextLoaderInitializer instead of web.xml(the old approach).


But It need web.xml to bind a JDBC datasource to JNDI context under java:comp/env/jdbc.


We know the method InitialContext#createSubcontext. But some application servers(e.g. Websphere) do not accept to edit the context java:comp/env/jdbc/.


Any solutions?


Versions:



  • Spring 4.0.7

  • Servlet 3.0


Aucun commentaire:

Enregistrer un commentaire