在spring+struts1中,spring是怎么注入的?是通过struts的配置文件中的action标签中的一个type属性,当实例化这个类时,会使用spring的工厂来创建这个类,而你现在自己写的这样怎么让spring来注入?它知道什么时候开始启用工厂来帮你创建对象并且注入吗?你要手动去获取, ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); userService = (UserService) context.getBean("userService");
Servlet和Filter注入,(是不可以直接注入的)
最新推荐文章于 2023-05-05 22:54:39 发布