We have developed a JEE5 web application (WAR) and running it in production under WebLogic 11g (10.3.5).
Now the same application should be deployed as separate appl
ServletContextListener.contextInitialized
can look at the ServletContext
and figure out which deployment is which
in web.xml, define a servlet context listener:
com.path.YourServletContextListener
and then in YourServletContextListener.java
, add a contextInitialized
method like this:
public void contextInitialized(ServletContextEvent sce)
{
ServletContext sc = sce.getServletContext();
String name = sc.getContextPath();
...
}
my thought is that you can use that name
to select from multiple data sources that you have configured. depending on how you've been deployed, you'll make a different database connection and have the correct application's data.