sth about spring annotation

applicationcontext.xml里加上

xmlns:context="http://www.springframework.org/schema/context"

<context:annotation-config />
<context:component-scan base-package="com.*****" />


dao不继承hibernatedaosupport用

@Resource
protected HibernateTemplate hibernateTemplate;

dao实现类前加上@Repository

service实现类前加上@Service

在用到其他类的类中 在该对象的setter方法上面加上 @Resource

其他就一个bean的就加个@Component (这个估计有其他方法的?cp不是这样的)

猜你喜欢

转载自409074615.iteye.com/blog/1843531