1. 添加spring支持,同前

  2. 添加Hibernate支持,注意加上注解支持

  3. 建包,并反向生成实体类,注意使用注解,去掉实体类映射文件

  4. 添加struts支持

  5. 找到applicationContext.xml文件,找到beans标签,在命名空间内,添加context,如下:

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

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-3.0.xsd

  1. applicationContext.xml文件内,添加context

<context:annotation-config></context:annotation-config>

<context:component-scan base-package="cn.jbit.dao.impl"></context:component-scan>

<context:component-scan base-package="cn.jbit.biz.impl"></context:component-scan>

<context:component-scan base-package="cn.jbit.action"></context:component-scan>

  1. 在需要托管的类名上方,添加@Service,来实现托管