spring中普通类调用service类

AbstractApplicationContext ctx
         new  ClassPathXmlApplicationContext( new  String []{ "applicationContext.xml" });
UserService us = (UserServiceImpl)ctx.getBean( "UserService" );
注意

applicationContext.xml是放在WEB-INF/classes/spring目录下,否侧找不到

查看方式   navigator 视图下  查看spring目录下是否有applicationContext.xml文件

猜你喜欢

转载自wb284551926.iteye.com/blog/2031195