我想在struts的Action里面注入多个Service?可是注入不进去,望大家指点一下,该怎么做?
这是一个企业信息Action 我想注入行业类型和企业类型的service 代码如下 @Autowired
private ComSitService comSitService;
//行业类型
@Autowired
private IndustryService industryService;
//企业类型
@Autowired
private CorpTypeService corpTypeService;
这是一个企业信息Action 我想注入行业类型和企业类型的service 代码如下 @Autowired
private ComSitService comSitService;
//行业类型
@Autowired
private IndustryService industryService;
//企业类型
@Autowired
private CorpTypeService corpTypeService;
解决方案 »
- 访问127.0.0.1 报错大虾们 过来看看!
- 如何使用Socket访问采用https协议传输的网页?
- 让spring管理struts1.x的action,怎么actionform里没数据
- 关于java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
- 一个servlet问题?急急急急急急急急急..............................
- SpringMVC 怎么使用正常的相对路径
- ejb起步
- 你一定要用J2EE的理由
- XSLT转换
- BufferedReader中的read(数组)方法和readline()方法
- websphere 加载不到native library
- 急,刚刚发布了项目,但是浏览器打开就报这么个错误,图贴不上来了
那你就生成他的setter方法啊
public void setComSitService(ComSitService comSitService) {
this.comSitService = comSitService;
}
public void setIndustryService(IndustryService industryService) {
this.industryService = industryService;
}
public void setCorpTypeService(CorpTypeService corpTypeService) {
this.corpTypeService = corpTypeService;
}
这些get set 都是自己写的 可不是生成的
private ComSitService comSitService;
这样注入是不需要get/set方法的
但是注入的话setter方法是要的
getter方法的话 可以不要
http://laoguo.blog.51cto.com/211591/108724
spring 中的注入就是用setters()方法注入的!
注入不了,是不是bean配置文件忘了修改一下# <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
# xsi:schemaLocation="http://www.springframework.org/schema/beans
# http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
# http://www.springframework.org/schema/context
# http://www.springframework.org/schema/context/spring-context-2.5.xsd">
# <context:annotation-config />
# </beans>