Pending verification
In the case of program development, spring's configuration files are often modified, and it takes time and effort to restart Tomcat to load the spring match. It is convenient to dynamically load the spring configuration file dynamically, if it can be manually loaded without restarting Tomcat. Spring seems to bring the refresh effect, as long as you get to Xmlwebapplicationcontext, call refresh.
The code is as follows:
- /**
- * Reload config file (only unexpectedly not guessed)
- * @Author Zhang Zhibong
- * @param request void
- * @Date August 24, 2016
- * Update Log
- * August 24, 2016 Zhang Zhibong first created
- *
- */
- @RequestMapping (value= "refreshXmlWebApplicationContext2016}")
- public void Refresh (HttpServletRequest request) {
- Xmlwebapplicationcontext context =
- (Xmlwebapplicationcontext) Webapplicationcontextutils
- . Getwebapplicationcontext (Request.getservletcontext ());
- Context.refresh ();
- }
Copy Code |
Spring dynamic load (refresh) configuration file [Copy link]