- public class Common {
- private UserService userService;
- public Common() {
- @SuppressWarnings(
- "resource"
- )
- AbstractApplicationContext ctx
- =
- new
- ClassPathXmlApplicationContext(
- new
- String []{"classpath:spring-mvc.xml","classpath:spring-mybatis.xml"
- });
- userService
- = (UserService) ctx.getBean("userService"
- );
- }
- }
来源: http://www.bubuko.com/infodetail-2145517.html