bean.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd
- ">
- <context:annotation-config />
- <bean id="personService"
- class="com.huqianhao.service.impl.PersonServiceBean">
- </bean>
- <bean id="personDao" class="com.huqianhao.dao.impl.PersonDaoImpl">
- </bean>
- </beans>
- package com.huqianhao.service.impl;
- import javax.annotation.Resource;
- import com.huqianhao.dao.PersonDao;
- import com.huqianhao.service.PersonService;
- public class PersonServiceBean implements PersonService {
- @Resource
- private PersonDao personDao;
- public void save(){
- personDao.save();
- }
- }
其余代码省略
转载于:https://blog.51cto.com/huqianhao/955573