当TomCat启动后能不能更改Spring的数据库连接,如何改?
[b]问题补充:[/b]
问题描述:
当进入系统前会有一个数据库连接选择,其中主要是改变连接的用户名和密码,但每次服务一启动,就自动加载了applicationContext.xml,不论你怎么改用户名,都只是前一次的,如何做才能达到我想要的?
[b]问题补充:[/b]
我用的是spring+jpa+flex
[b]问题补充:[/b]
手动加载spring的配置文件:
具体如何实现?
[b]问题补充:[/b]
ContextLoader contextLoader = new ContextLoader();
contextLoader.initWebApplicationContext(request.getSession().getServletContext());
找不到applicationContext.xml,它给的路径是/WEB-INF/applicationContext.xml,而我的是在/WEB-INF/classes/applicationContext.xml下的,怎样改啊?
[b]问题补充:[/b]
但是它出错啦,当刷新页面,切换数据库时:
Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml