关于spplicationContext.xml里面类的配置简化问题

来源:4-3 修改员工

xiemaoyu

2018-08-30 19:07

因为每一个实体类都要在spplicationContext.xml中配置Action的类,配置Service,配置DAO类。有没有注解的方式或者其他方式,有代码的可以贴一下

写回答 关注

1回答

  • xiemaoyu
    2018-08-30 20:33:09

    有使用注解的不?

    <!-- 配置Action由spring自动创建 -->

    <bean id="employeeAction" class="com.muke.employee.action.EmployeeAction" scope="prototype">

    <property name="employeeService" ref="employeeService"/>

    <property name="departmentService" ref="departmentService"/>

    </bean>

    <bean id="departmentAction" class="com.muke.employee.action.DepartmentAction" scope="prototype">

    <property name="departmentService" ref="departmentService"/>

    </bean>

    <!-- 配置业务层的类 -->

    <bean id="employeeService" class="com.muke.employee.service.impl.EmployeeServiceImpl">

    <property name="employeeDao" ref="employeeDao"/>

    </bean>

    <bean id="departmentService" class="com.muke.employee.service.impl.DepartmentServiceImpl">

    <property name="departmentDao" ref="departmentDao"/>

    </bean>

    <!-- 配置DAO的类 -->

    <bean id="employeeDao" class="com.muke.employee.dao.impl.EmployeeDaoImpl">

    <property name="sessionFactory" ref="sessionFactory"/>

    </bean>

    <bean id="departmentDao" class="com.muke.employee.dao.impl.DepartmentDaoImpl">

    <property name="sessionFactory" ref="sessionFactory"/>

    </bean>


基于SSH实现员工管理系统之案例实现篇

SSH框架整合案例之实现篇,手把手带你实现员工管理系统

50212 学习 · 323 问题

查看课程

相似问题