写一个银行转账案例,

案例结构如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWcAAAEWCAIAAAA1pMG+AAAgAElEQVR4nO2df2wUV4Lne/447T8n3R9zUpS/0GRuCMGaufCjHdLjeLndvXF0ezpGO/LKlhLiEKkV4FDsZAgh2EtsbNMBkukbksCKjGNmg9MEJpljdptwxOdhV45xxEBgiUBtgTG2g93uNm33r+ou79X9Ud1Vr+q9qq5qt/vH6+9HT0rX6/dePRPXx6+eu752SAAAYAdHqSdgCXf9+lJPAQCQobys8S+Ha5UiSVJXw6N0KfUcAah2ysgav/uf/4k8nLx2oavh0XTi/8x89d6R538mv4A1ACg5xbPG0NCQx+MxevdfemqFmePCzPHIbe/MN557f3zj4fhXXQ2Pznz13o0zb7nr18svYA0ASk6RrDE4OFhTU7N69WqjBl/2rBcil8myd8vmroZHjzz/M3f9erkcef5nXQ2Psvc4gj5fx/YrwRzTGPO6HBnc/myF2+93OxwOl3dMkiTJ7862yFQAALQUwxqyMpqamsyssX+9MPN7siwlxpU7FHf9egt3KJNX3mt4v6Ph/Y5Dd5jvy4qgqhxqpd8NWQCQixW3hqKM5uZmE2tIkhQc/WjiVGNw9CNJkn736n+WC92MWakdyOfraLjwLf2GvI4gtaAVid8NZwCQk5W1BqmMnNaYONUoLf3rxKlGSZKEe8flIknS9w986/jeO47vvfP9A99KZtbItdbIIK8vZD3AGgDYZmWt4fF4VhP09vYatQz+8Yhw+62fr3EIt98K/vEdSZKE2x7htkeSJMUXju+9Y3gmK/saY16vP/sqIwvdTYvfrd6u+L0QCAAsyuU3rxOnGhVrZJYb37wlfPOW0sDxH0/8+1euLvMs6lZnxg3UVoe6X6rbAQEAZCgLa0z84Y3wH1uE22/d+E29cPut8FDL/T+8IXzzhvDNG3IDZbkBACg55WGNU43/drcr/M+//PkaR/iff/lvd7omTjX2uR/vcz9e6qkBAPSUhTW+6vnJ/5v8IHLb+0/v/U3ktle6/8FXPT8hGzi+947jkZOlmh4AgKQsrDE90v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PxYQ7fWkKzkhppZQ3f7kW3u8o6RK3ryrqKQ1kC8KChf+LEGo95SbqjBHQqx3cC6Q9EMoV9rIF4UcA0/1qDXGpl3zXJDLeyGqgsL7W4oMYS5NRAvCjiDH2uw3ypsbqj5b1lz36HYBT/8QTnCiTVWLDd0zOsy+E0Hqyn1NqwBOIQHa5hQgNxQYklvqIzMEp++wGENwCGcWwMAUHBgDQCAPWANAIA9YA0AgD3+PzSlG9SD5JZvAAAAAElFTkSuQmCC" alt="" />

AccountDao是Dao层。Account是数据库的实体类。AccountService是业务层。TestAccount是测试类。applicationContext.xml是Spring的配置文件。

第一步:导jia包:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAekAAAFRCAIAAADfNcLYAAAgAElEQVR4nO2d3Y8UV5rmo+/3YqRZaa/7YntXe9+oyL2Z3quV/4TRQLehOq9G0xcjrZttqdXs9LbXGLTRtjzl0bY85VWjdbcpDC4RXRQU4E9MYcBAfQBhDOargCqgivrKqsqs2IvIjDgf73siMjMyM07k81MIJRHnnHjPG5FPnjiZdR7n6uPgxKVHu/7+VwFonnPnzlW3tqrVrVqtWqtVt7dr29u1anVre7s2OTk5Pj5+euJ0r2MEAHSPSqUyNDS0urq6srKytPTy+fMXCwvPnjyZv3nr2+npG1evTl26dPX8+Yvnzn1+5crVd/75nadPn0Z1d/39r05cenRm5vnVx4G4nbj0aOjwqHiKSqXiQLvb4ezZs1tbm7p8b2/Xvvjii7W1tbGxsbNnz/Y6zCR8t+SUXL/XYViJV0bqekj+bl1otx1MTExsbm6Q8j0+Pj42NjY2NjY+Pt7rMJPI3xvAHnKj3b5bcuqUvTQVvHITxaPChs4ay8ThMS14ZTYUQ9fyd+tCu+3g9OnTmxuVTy7fmJy5c3Hm7sWZu5PTdy7O3J2cufPplZuPHj68e+eOBdoNWicn2u2Voyh8t5Qsx75bqpfxyonqLQgkW9pcRthFJMx3S45TKpfpuJvtWo+BdtvB+Pj4RmX93MWparVarVY3NzdffPmvm5ub1Wr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wcOf35tfW1haX16r1La3z50b/ptfv7d7ZHLXWxfe/g//cd++3fv27du976g+35258aO4MmujRa/slFxP8BJr1BZODe0GIBdAu7vH+6MXPzg9c39h7flyZb2yEWxv17a3d49M/s2v39t15MKuX47s+uXI7n1H9+3bp9fthPFjvZryARA7K+gL+kO7AcgL0O7u8ds/nDpz+f69+bX5pcrKWmV9Y6Na296qbqeqnJnxo4hiZcm5Kkavod0A5AVod/f4hwPHvvaf3X689vDZ+vzS+vPlyvxSZWOrFqSyneyE8SO0GwBbgXZ3j1d/86erd5dmHyzffrx6b379/sL69/Prtx+vBmlsJ7MyfhRW7w8lWdvRaAbaDUCOgXZ3j384cOzL2SfXv385c3/lxsOVm49Wbj5cmb6/HBUw205mY/zYqChY3UTtQrsBsAZod/f47R9OTXx945s7i1fvLl27+/La9y+v3V26encxPNq87SQAoH+BdneP90cvjn3yyb2572a/n7t2d+HqnedX7yzMfD/X67gAAPYB7e4q7/7pZPXllbUX1xYXZp7P31h8NrO2eC081LztJACgf4F2d5vX3vr4N0Oj+9/9eP+7x/e/+/FvhtRMAQBAItBuAACwD2g3AADYR9e0+/8DO3WctoAjv68AAAAASUVORK5CYII=" alt="" />

第二步:写实体类:

//对应数据库中的account表
public class Account {
private int id;
private String name;
private double money;
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the money
*/
public double getMoney() {
return money;
}
/**
* @param money the money to set
*/
public void setMoney(double money) {
this.money = money;
} }

第三步:写 AccountDao接口:

public interface AccountDao {

//加钱
public void addmoney(String name,double money);
//减钱
public void reducemoney(String name ,double money);
}

第四步:写AccountDao接口的实现类

//继承了JdbcDaoSupport,这样就可以Spring的JDBc的模板
public class AccountDaoimpl extends JdbcDaoSupport implements AccountDao {
public void addmoney(String name, double money) {
String sql="update account set money=money+"+money+"where name=?";
this.getJdbcTemplate().update(sql, name);
} public void reducemoney(String name, double money) {
String sql="update account set money=money-"+money+"where name=?";
this.getJdbcTemplate().update(sql, name); } }

第五步:写转账的接口

/*
* 转账的接口
*/
public interface AccountService {
//转钱
public void transfer(String outAccount,String inAccount,double money); }

第六步:转账接口的实现类

第一种写法:里面的accountDao用set/get方法注入。

public class AccountServiceimpl implements AccountService {

  /**
* 这个类是转账接口的实现类。我们要考虑的问题是怎么把Dao给注入进去。
* 这里用普通的方式(get/set)
*
*
*/ private AccountDao accountDao; /**
* @return the accountDao
*/
public AccountDao getAccountDao() {
return accountDao;
} /**
* @param accountDao the accountDao to set
*/
public void setAccountDao(AccountDao accountDao) {
this.accountDao = accountDao;
} public void transfer(String outAccount, String inAccount, double money) { accountDao.addmoney(inAccount, money);
accountDao.reducemoney(outAccount, money); } }

第二种写法:里面的accountDao用@AutoWired注解的方式。

public class AccountServiceimpl implements AccountService {

  /**
* 这个类是转账接口的实现类。我们要考虑的问题是怎么把Dao给注入进去。
* 这里用注解的方式 @Autowired。
* 一旦用这种方式,之前那种set/get方式在applicationContext.xml中的
* <bean id="AccountService" class="cn.itcast.service.AccountServiceimpl">
<!-- <property name="accountDao" ref="AccountDao"/> -->
</bean>
里面的property name="accountDao" ref="AccountDao"/>必须去掉。
*
*
*/
@Autowired
private AccountDao accountDao; public void transfer(String outAccount, String inAccount, double money) { accountDao.addmoney(inAccount, money);
accountDao.reducemoney(outAccount, money); } }

第七步:写applicationContext.xml

第一种写法对应(第六步中的第一种写法:里面的accountDao用set/get方法注入)。

<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
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/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <!-- <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/> -->
<!-- 引入peoperties文件 -->
<!-- <context:property-placeholder location="classpath:db.properties"/> -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:db.properties"/>
</bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${driver}"/>
<property name="jdbcUrl" value="${url}"></property>
<property name="user" value="${username}"></property>
<property name="password" value="${password}"></property>
</bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean> <bean id="AccountDao" class="cn.itcast.dao.AccountDaoimpl">
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
<bean id="AccountService" class="cn.itcast.service.AccountServiceimpl">
<!--
这里用的是property这种方式,也就是说在AccountServiceimpl这个类里面的accountDao属性
必须要有set方法不然会报错,属性不能注入。 -->
<property name="accountDao" ref="AccountDao"/>
</bean>
</beans>

第二种写法:对应(第六步里面的accountDao用@AutoWired注解的方式。)

<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
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/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <!-- <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/> -->
<!-- 引入peoperties文件 -->
<!-- <context:property-placeholder location="classpath:db.properties"/> -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:db.properties"/>
</bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${driver}"/>
<property name="jdbcUrl" value="${url}"></property>
<property name="user" value="${username}"></property>
<property name="password" value="${password}"></property>
</bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean> <bean id="AccountDao" class="cn.itcast.dao.AccountDaoimpl">
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
<bean id="AccountService" class="cn.itcast.service.AccountServiceimpl"> </bean>
</beans>

第八步:写Junit测试类

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:applicationContext.xml")
public class TestAccount {
@Autowired
private AccountService accountService; @Test
public void accounttest()
{ accountService.transfer("aaa", "bbb", 200);
}
}

总结:这里要注意的是:@Autowired这个注解的使用不需要在ApplicationContext.xml中配置bean.只要在AccountServiceimpl中配置了AccountDaoimpl用@Autowired修饰了那么就会根据类型来创建对象。

所以上面的注解形式的流程是:在测试程序中,根据

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:applicationContext.xml")

把ApplicationContext.xml文件引入进来。然后当执行

@Autowired
    private AccountService accountService;

时发现有一个@Autowired注解。马上去bean容器中,在对应的类型匹配的bean注入(spring先找类型为AccountService的bean)。

找到后注入。那么accountService不就有值了吗,然后在创建AccountServiceimpl的过程中。发现里面有一个

@Autowired
    private AccountDao accountDao;

同理Spring马上再去bean容器中寻找类型为AccountDao的bean.找到后注入到accountDao中。那么accountDao就有值了。

解释一下为什么加一句<property name="accountDao" ref="AccountDao"/> 就会报错。

<bean id="AccountService" class="cn.itcast.service.AccountServiceimpl">
<!--
这里用的是property这种方式,也就是说在AccountServiceimpl这个类里面的accountDao属性
必须要有set方法不然会报错,属性不能注入。 -->
<!-- <property name="accountDao" ref="AccountDao"/> -->
</bean>

因为:按照上面的解释是:在测试代理中先看到了@Autowire注解时。再去bean容器中找到相应的类型注入。如果<bean id="AccountService" class="cn.itcast.service.AccountServiceimpl">中还有一个<property name="accountDao" ref="AccountDao"/>,如果用<property 这样的话就必须要用set/get方式,给accountDao注入值。而如果我这里不写这句话,等AccountServiceimpl创建时,发现

@Autowired
  private AccountDao accountDao;

就会再去bean容器中找到相应的类型注入。

05-11 11:26