为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

正在回答

1 回答

有使用注解的不?

<!-- 配置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>


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

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

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信