1:我的serveice和dao如下
,如何配置action的自动注入,不用写配置文件的,我用了
<context:component-scan base-package="cn.ajicompany" scoped-proxy="interfaces"></context:component-scan>
但是就是注入不了。
@Repository("customerDao")
public class CustomerDaoImpl extends BaseDaoImpl<Customer> implements CustomerDao {}
@Service("customerService")
public class CustomerServiceImpl implements CustomerService {
@Autowired
private CustomerDao customerDao;
.....
}
public class loginAction extends ActionSupport {
@Autowired
private CustomerService customerService;
,如何配置action的自动注入,不用写配置文件的,我用了
<context:component-scan base-package="cn.ajicompany" scoped-proxy="interfaces"></context:component-scan>
但是就是注入不了。
@Repository("customerDao")
public class CustomerDaoImpl extends BaseDaoImpl<Customer> implements CustomerDao {}
@Service("customerService")
public class CustomerServiceImpl implements CustomerService {
@Autowired
private CustomerDao customerDao;
.....
}
public class loginAction extends ActionSupport {
@Autowired
private CustomerService customerService;
解决方案 »
- spring+hibernate+jpa报错
- hibernate的cascade只能实现一层级联,在多层就不行了,????????????????????
- 使用HibernateTemplagte发生异常时事务没有回滚
- 大家看看我的过滤器哪里有问题?
- 关于异常的处理
- hibernate 表连接的问题 left inner join
- Hibernate操作Clob数据总是报Unsupported date conversion
- 关于velocity.log的问题
- 大家一起来讨论一下这样一个基于Struts的框架
- 第一个EJB,服务器是weblogic,总是提示没有weblogic没有run,
- maven subclipse tortoiseSVN m2Eclipse subversion到底是什么东西
- 启动tomcat出现以下异常,该怎么处理?求赐教
@Autowired setter方法上面
然后action里面的service接口取名就为这个xxxxxService
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<!-- default: /WEB-INF/applicationContext.xml -->
</listener> <context-param>
<param-name>contextConfigLocation</param-name>
<!-- <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value> -->
<param-value>classpath:beans.xml</param-value>
</context-param>
还有就是action也要给spring管理