﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-jinfeng_wang-随笔分类-spring</title><link>http://www.blogjava.net/jinfeng_wang/category/480.html</link><description>G-G-S,D-D-U!</description><language>zh-cn</language><lastBuildDate>Thu, 20 Mar 2008 10:19:20 GMT</lastBuildDate><pubDate>Thu, 20 Mar 2008 10:19:20 GMT</pubDate><ttl>60</ttl><item><title>XDoclet的build.xml写法 zz</title><link>http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187409.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Thu, 20 Mar 2008 01:52:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187409.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/187409.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187409.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/187409.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/187409.html</trackback:ping><description><![CDATA[http://gocom.primeton.com/showblogarticle.php?cat_id=all&amp;articleId=&amp;blogId=14478&amp;?PHPSESSID=0d485ace30025757c7b9a22da013c1a0&amp;page=4&amp;PHPSESSID=1370043e8b6d902ac0f6fdc3fe7776a8<br />
<br />
<br />
&nbsp;XDoclet的build.xml写法
<p><br />
</p>
<div>
<ol>
    <li>&lt;?xml version="1.0" encoding="utf-8"?&gt; </li>
    <li>&lt;project name="appgen" default="web-demo" basedir="."&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;property file="build.properties" /&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;path id="xdoclet.classpath"&gt; </li>
    <li>&lt;fileset dir="${lib}"&gt; </li>
    <li>&lt;include name="**/*.jar" /&gt; </li>
    <li>&lt;/fileset&gt; </li>
    <li>&lt;path location="${classes}" /&gt; </li>
    <li>&lt;/path&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;target name="clean"&gt; </li>
    <li>&lt;delete&gt; </li>
    <li>&lt;fileset dir="${gen}"&gt; </li>
    <li>&lt;include name="*.xml" /&gt; </li>
    <li>&lt;/fileset&gt; </li>
    <li>&lt;/delete&gt; </li>
    <li>&lt;/target&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;!-- 这个target可以生成，strutsconfigxml , strutsvalidationxml ,web.xml--&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;target name="web-demo" depends="clean,Spring-service-beans,Spring-action-beans,Spring-dao-beans"&gt; </li>
    <li>&lt;taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="xdoclet.classpath" /&gt; </li>
    <li>&lt;webdoclet destDir="${gen}" mergeDir="${merge}" force="false"&gt; </li>
    <li>&lt;fileset dir="${src}"&gt; </li>
    <li>&lt;include name="**/*Action.java" /&gt; </li>
    <li>&lt;include name="**/*Form.java" /&gt; </li>
    <li>&lt;/fileset&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;strutsconfigxml Version="1.2" destDir="${gen}" validateXML="true"/&gt; </li>
    <li>&lt;strutsvalidationxml destDir="${gen}" /&gt; </li>
    <li>&lt;deploymentdescriptor Servletspec="2.4" destDir="${gen}" /&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;/webdoclet&gt; </li>
    <li>&lt;/target&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;target name="ReplaceConfigFile" depends="web-demo"&gt; </li>
    <li>&lt;copy todir="${webinf}"&gt; </li>
    <li>&lt;fileset dir="${gen}"&gt; </li>
    <li>&lt;include name="struts-config.xml"/&gt; </li>
    <li>&lt;include name="validation.xml"/&gt; </li>
    <li>&lt;include name="action-beans.xml"/&gt; </li>
    <li>&lt;include name="dao-beans.xml"/&gt; </li>
    <li>&lt;include name="service-beans.xml"/&gt; </li>
    <li>&lt;/fileset&gt; </li>
    <li>&lt;/copy&gt; </li>
    <li>&lt;/target&gt; </li>
    <li>&lt;!-- 生成spring的xml文件 --&gt; </li>
    <li>&lt;target name="Spring-service-beans" description="Spring-application-beans"&gt; </li>
    <li>&lt;taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" /&gt; </li>
    <li><span>&lt;springdoclet
    excludedTags="@version,@author,@todo" destDir="gen" verbose="true"
    addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet
    Team,@author XDoclet,@version ${version}"&gt; </span></li>
    <li>&lt;fileset dir="src" includes="**/*ServiceImpl.java"/&gt; </li>
    <li>&lt;springxml destinationFile="service-beans.xml" destDir="gen"/&gt; </li>
    <li>&lt;/springdoclet&gt; </li>
    <li>&lt;/target&gt; </li>
    <li>&nbsp;</li>
    <li>&nbsp;</li>
    <li>&lt;!-- 生成spring的xml文件 --&gt; </li>
    <li>&lt;target name="Spring-action-beans" description="Spring-servlet-beans"&gt; </li>
    <li>&lt;taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" /&gt; </li>
    <li><span>&lt;springdoclet
    excludedTags="@version,@author,@todo" destDir="gen" verbose="true"
    addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet
    Team,@author XDoclet,@version ${version}"&gt; </span></li>
    <li>&lt;springxml destinationFile="action-beans.xml" destDir="gen"/&gt; </li>
    <li>&lt;fileset dir="src" includes="**/*Action.java"/&gt; </li>
    <li>&lt;/springdoclet&gt; </li>
    <li>&lt;/target&gt; </li>
    <li>&nbsp;</li>
    <li>&nbsp;</li>
    <li>&lt;!-- 生成spring的xml文件 --&gt; </li>
    <li>&lt;target name="Spring-dao-beans" description="Spring-servlet-beans"&gt; </li>
    <li>&lt;taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" /&gt; </li>
    <li><span>&lt;springdoclet
    excludedTags="@version,@author,@todo" destDir="gen" verbose="true"
    addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet
    Team,@author XDoclet,@version ${version}"&gt; </span></li>
    <li>&lt;springxml destinationFile="dao-beans.xml" destDir="gen"/&gt; </li>
    <li>&lt;fileset dir="src" includes="**/*DAOIbatis.java"/&gt; </li>
    <li>&lt;/springdoclet&gt; </li>
    <li>&lt;/target&gt; </li>
    <li>&nbsp;</li>
    <li>&lt;/project&gt; </li>
    <li>&nbsp;</li>
</ol>
</div>
<p><br />
＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝</p>
<p><br />
</p>
<div>
<ol>
    <li>/** </li>
    <li>* @spring.bean id="UserDAO" </li>
    <li>* @spring.property name="dataSource" ref="dataSource" </li>
    <li>* @spring.property name="sqlMapClient" ref="sqlMapClient" </li>
    <li>* </li>
    <li>* @author Conan </li>
    <li>* </li>
    <li>*/ </li>
    <li>public class UserDAOIbatis extends BaseDAOIBatis implements UserDAO {....} </li>
</ol>
</div>
<p><br />
</p>
<p>-------------------------------------------</p>
<p><br />
</p>
<div>
<ol>
    <li>/** </li>
    <li>* @spring.bean id="UserService" </li>
    <li>* @spring.property name="userDao" ref="UserDAO" </li>
    <li>* </li>
    <li>* @author Conan </li>
    <li>* </li>
    <li>*/ </li>
    <li>public class UserServiceImpl extends BaseManager implements UserService {...} </li>
</ol>
</div>
<p><br />
<br />
&nbsp;---------------------------------------------</p>
<p><br />
</p>
<div>
<ol>
    <li>/** </li>
    <li>* </li>
    <li>* @struts.action path="/add" name="UserForm" input="/add.jsp" </li>
    <li>* type="org.springframework.web.struts.DelegatingActionProxy" </li>
    <li>* validate="true" scope="request" </li>
    <li>* </li>
    <li>* @struts.action-forward name="success" path="/success.jsp" redirect="true" </li>
    <li>* @struts.action-forward name="failure" path="/failure.jsp" redirect="true" </li>
    <li>* </li>
    <li>* @struts.action-form name="UserForm" </li>
    <li>* </li>
    <li>* @spring.bean </li>
    <li>* name="/add" </li>
    <li>* @spring.property </li>
    <li>* name="userService" </li>
    <li>* ref="UserService" </li>
    <li>* </li>
    <li>*/ </li>
    <li>public final class AddAction extends BaseAction {...} </li>
</ol>
</div>
<p><br />
</p>
<p>------------------------------------------</p>
<p><br />
</p>
<div>
<ol>
    <li>/** </li>
    <li>* @struts.form name="UserForm" </li>
    <li>*/ </li>
    <li>public class UserForm extends BaseForm{ </li>
    <li>&nbsp;</li>
    <li>/** </li>
    <li>* @struts.validator type="required" </li>
    <li>* @struts.validator type="mask" msgkey="error.age" </li>
    <li>* @struts.validator-var name="mask" value="^[0-9]*$" </li>
    <li>*/ </li>
    <li>public void setAge(Integer age) { </li>
    <li>this.age = age; </li>
    <li>} </li>
    <li>&nbsp;</li>
    <li>} </li>
</ol>
</div>
<p><br />
</p>
<p><br />
</p>
<br />
<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/187409.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2008-03-20 09:52 <a href="http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187409.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XDoclet Spring+Struts HowTo zz</title><link>http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187406.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Thu, 20 Mar 2008 01:42:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187406.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/187406.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187406.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/187406.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/187406.html</trackback:ping><description><![CDATA[http://www.logemann.org/day/archives/000148.html<br />
<br />
<br />
<p>For all those out there using Spring together with Struts, i created
a small howTo regarding automatic generation of relevant files,
especially the boring action-servlet-xml file which must be in synch
with your struts-config.xml, at least for all Struts actions which
should be injected by Spring.</p>
<p>Lets start with the Action class:</p>
<table border="1">
    <tbody>
        <tr>
            <td>
            <pre>/**<br />
            * Action to delete a Client<br />
            * Date: 09.02.2005<br />
            * Time: 15:29:15<br />
            *<br />
            * @author Logemann - Logentis e.K. (ml@logentis.de)<br />
            * @version $Id$<br />
            * @struts.action path="clientDelete" validate="false"<br />
            *            type="org.springframework.web.struts.DelegatingActionProxy"<br />
            *            name="emptyform"<br />
            * @struts.action-forward name="back" <br />
            *             path="/clientManager.html" redirect="true"<br />
            * @spring.bean name="clientDelete"<br />
            */<br />
            public class ClientDeleteAction extends Action {<br />
            <br />
            <p>    ClientManager clientManagerService;</p>
            <br />
            <br />
            <p>    /**<br />
            <br />
            * Spring injection<br />
            <br />
            *<br />
            <br />
            * @param clientManagerService clientManagerService<br />
            <br />
            * @spring.property ref="clientManagerService"<br />
            <br />
            */<br />
            <br />
            public void setClientManagerService(ClientManager clientManagerService) {<br />
            <br />
            this.clientManagerService = clientManagerService;<br />
            <br />
            }<br />
            <br />
            [..]<br />
            <br />
            </p>
            </pre>
            <br />
            </td>
        </tr>
    </tbody>
</table>
<p>With this tags, the ant build target outlined below will create a
struts-config.xml and the necessary action-servlet.xml needed by
Spring. Lets see how the target looks:</p>
<table border="1">
    <tbody>
        <tr>
            <td>
            &lt;path id="classpath"&gt;
            <p>        &lt;fileset dir="c:/xdoclet-1.2.2" includes="*.jar"/&gt;<br />
            &lt;fileset dir="c:/j2sdkee1.3.1/lib" includes="*.jar"/&gt;<br />
            &lt;fileset dir="c:/struts/lib" includes="struts.jar"/&gt;<br />
            &lt;/path&gt;</p>
            <p>    &lt;taskdef name="springdoclet" <br />
            classname="xdoclet.modules.spring.SpringDocletTask"<br />
            classpathref="classpath"/&gt;<br />
            <br />
            &lt;taskdef name="webdoclet" <br />
            classname="xdoclet.modules.web.WebDocletTask"<br />
            classpathref="classpath"/&gt;</p>
            <p>   &lt;target name="myTest"&gt;<br />
            &lt;webdoclet destDir="c:\" force="true" verbose="true"&gt;<br />
            &lt;fileset dir="${src.dir}"&gt;<br />
            &lt;include name="**/*Form.java" /&gt;<br />
            &lt;include name="**/*Action.java" /&gt;<br />
            &lt;include name="**/*Servlet.java" /&gt;<br />
            &lt;/fileset&gt;<br />
            &lt;strutsconfigxml version="1.1" validateXml="true"/&gt;<br />
            &lt;/webdoclet&gt;</p>
            <p>        &lt;springdoclet destDir="c:\" verbose="true"&gt;<br />
            &lt;fileset dir="${src.dir}"&gt;<br />
            &lt;include name="**/*Action.java" /&gt;<br />
            &lt;/fileset&gt;<br />
            &lt;springxml destinationFile="action-servlet.xml"/&gt;<br />
            &lt;/springdoclet&gt;<br />
            &lt;/target&gt;<br />
            </p>
            </td>
        </tr>
    </tbody>
</table>
<p>Be sure to modify the classpath definition and the destDir values of
springdoclet and webdoclet to suit your needs. Right now the Spring
task only searches for Actions in order to create action-servlet.xml,
if you also want to create your normal service beans like
ClientManagerService, you should create another springdoclet task and
output things to applicationContext.xml if you like. </p>
<p>But this is mostly users choice, as you know, Spring supports from
one to many bean definition files and its up to you how you want to
have your spring xml world.</p>
<p>This will be created when you run the mentioned target:</p>
<p>(action-servlet.xml)<br />
</p>
<table border="1">
    <tbody>
        <tr>
            <td><br />
            &lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
            &lt;!DOCTYPE beans PUBLIC<br />
            "-//SPRING//DTD BEAN//EN"<br />
            "http://www.springframework.org/dtd/spring-beans.dtd"&gt;
            <p>&lt;beans<br />
            default-autowire="no"<br />
            default-lazy-init="false"<br />
            default-dependency-check="none"<br />
            &gt;</p>
            <p>  &lt;bean<br />
            name="clientDelete"<br />
            class="de.logentis.versysng.action.clientmanager.ClientDeleteAction"<br />
            &gt;</p>
            <p>    &lt;property name="clientManagerService"&gt;</p>
            <p>      &lt;ref bean="clientManagerService"/&gt;<br />
            &lt;/property&gt;</p>
            <p>  &lt;/bean&gt;</p>
            <p>  &lt;!--<br />
            To include additional bean definitions for Spring in the generated<br />
            application context file, add a file to your XDoclet merge directory<br />
            called spring-beans.xml that contains the &lt;bean&gt;&lt;/bean&gt; markup.<br />
            --&gt;<br />
            &lt;/beans&gt;<br />
            </p>
            </td>
        </tr>
    </tbody>
</table>
<p><br />
(struts-config.xml)<br />
</p>
<br />
&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
<p>&lt;!DOCTYPE struts-config PUBLIC "-//Apache Software
Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"&gt;</p>
<p>&lt;struts-config&gt;</p>
<p>  &lt;!-- ========== Data Sources Definitions =================================== --&gt;<br />
&lt;!--<br />
Define your Struts data sources in a file called struts-data-sources.xml and place<br />
it in your merge directory.<br />
--&gt;</p>
<p>  &lt;!-- ========== Form Bean Definitions =================================== --&gt;<br />
&lt;form-beans&gt;</p>
<p>    &lt;!--<br />
If you have non XDoclet forms, define them in a file called struts-forms.xml and<br />
place it in your merge directory.<br />
--&gt;<br />
&lt;/form-beans&gt;</p>
<p>  &lt;!-- ========== Global Exceptions Definitions =================================== --&gt;<br />
&lt;!--<br />
Define your exceptions in a file called global-exceptions.xml and place<br />
it in your merge directory.<br />
--&gt;</p>
<p>  &lt;!-- ========== Global Forward Definitions =================================== --&gt;<br />
&lt;!--<br />
Define your forwards in a file called global-forwards.xml and place<br />
it in your merge directory.<br />
--&gt;</p>
<p>  &lt;!-- ========== Action Mapping Definitions =================================== --&gt;<br />
&lt;action-mappings&gt;<br />
&lt;action<br />
path="clientDelete"<br />
type="org.springframework.web.struts.DelegatingActionProxy"<br />
name="emptyform"<br />
scope="request"<br />
unknown="false"<br />
validate="false"<br />
&gt;<br />
&lt;forward<br />
name="back"<br />
path="/clientManager.html"<br />
redirect="true"<br />
/&gt;<br />
&lt;/action&gt;</p>
<p> &lt;!-- If you have non XDoclet actions, define them in a file
called struts-actions.xml and place it in your merge directory. --&gt;<br />
&lt;/action-mappings&gt;</p>
<p>   &lt;!-- Define your Struts controller in a file called struts-controller.xml and place it in your merge directory. --&gt;</p>
<p> &lt;!-- Define your Struts message-resources in a file called
struts-message-resources.xml and place it in your merge directory.
--&gt;</p>
<p>   &lt;!-- Define your Struts plugins in a file called struts-plugins.xml and place it in your merge directory. --&gt;</p>
&lt;/struts-config&gt;<br />
<br />
<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/187406.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2008-03-20 09:42 <a href="http://www.blogjava.net/jinfeng_wang/archive/2008/03/20/187406.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pro Spring: Spring and EJB (zz)</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/18/2192.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Fri, 18 Mar 2005 06:35:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/18/2192.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/2192.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/18/2192.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/2192.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/2192.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Pro Spring: Spring and EJBLearn how to use Spring with EJB applictionsSummary-->SummaryIn traditional J2EE applications, Enterprise JavaBeans (EJB) often forms the cornerstone of an application'...&nbsp;&nbsp;<a href='http://www.blogjava.net/jinfeng_wang/archive/2005/03/18/2192.html'>阅读全文</a><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/2192.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-18 14:35 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/18/2192.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pro Spring的目录</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/06/1768.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Sun, 06 Mar 2005 06:46:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/06/1768.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1768.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/06/1768.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1768.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1768.html</trackback:ping><description><![CDATA[PART 1 ■ ■ ■ Getting Started with Spring<BR>CHAPTER 1 Introducing Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3<BR>CHAPTER 2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15<BR>CHAPTER 3 The Sample Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35<BR>PART 2 ■ ■ ■ Spring Basics<BR>CHAPTER 4 Introducing Inversion of Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49<BR>CHAPTER 5 Beyond the Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93<BR>PART 3 ■ ■ ■ Aspect Oriented Programming<BR>with Spring<BR>CHAPTER 6 Introducing Spring AOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157<BR>CHAPTER 7 More on Spring AOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205<BR>PART 4 ■ ■ ■ Data Access with Spring<BR>CHAPTER 8 Spring JDBC Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249<BR>CHAPTER 9 Using Hibernate in Spring Applications . . . . . . . . . . . . . . . . . . . . . . . 279<BR>CHAPTER 10 iBATIS Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311<BR>vi ■CONTENTS AT A GLANCE<BR>PART 5 ■ ■ ■ Spring in the Middle Tier<BR>CHAPTER 11 Designing and Implementing Spring-Based Applications . . . . . . 353<BR>CHAPTER 12 Transaction Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395<BR>CHAPTER 13 Spring and J2EE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439<BR>CHAPTER 14 Job Scheduling with Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487<BR>CHAPTER 15 Mail Support in Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517<BR>CHAPTER 16 Using Spring Remoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549<BR>PART 6 ■ ■ ■ Web Applications with Spring<BR>CHAPTER 17 Web Applications with Spring MVC . . . . . . . . . . . . . . . . . . . . . . . . . . 599<BR>CHAPTER 18 Beyond JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645<BR>CHAPTER 19 Spring and Struts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679<BR>PART 7 ■ ■ ■ Appendixes<BR>APPENDIX A Testing with Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697<BR>APPENDIX B The Spring Rich Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711<BR>APPENDIX C Spring IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729<BR>APPENDIX D The Future of Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743<img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1768.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-06 14:46 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/06/1768.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring Transaction</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/04/1683.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Fri, 04 Mar 2005 06:15:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/04/1683.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1683.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/04/1683.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1683.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1683.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>Spring Transaction</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：通过</SPAN><SPAN lang=EN-US>Template+Callback</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">机制，实现对各种事务的统一封装。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;bean id="transactionManager" //</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对</SPAN><SPAN lang=EN-US>JDBC Transaction</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的封装</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="<SPAN style="COLOR: red">org.springframework.jdbc.datasource.DataSourceTransactionManager</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="<SPAN style="COLOR: red">dataSource</SPAN>"&gt; <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="dataSource"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;bean id="transactionManager" //</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对</SPAN><SPAN lang=EN-US>Hibernate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事务的封装</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="<SPAN style="COLOR: red">org.springframework.orm.hibernate.HibernateTransactionManager</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="<SPAN style="COLOR: red">sessionFactory</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="sessionFactory"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;bean id="transactionManager"//</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对</SPAN><SPAN lang=EN-US>JDO</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事务的封装</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="<SPAN style="COLOR: red">org.springframework.orm.jdo.JdoTransactionManager</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="<SPAN style="COLOR: red">persistenceManagerFactory</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="persistenceManagerFactory"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;bean id="transactionManager" //</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对</SPAN><SPAN lang=EN-US>JTA </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事务的封装</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="<SPAN style="COLOR: red">org.springframework.transaction.jta.JtaTransactionManager</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="<SPAN style="COLOR: red">transactionManagerName</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;java:/TransactionManager&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;/bean&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;bean id="courseService"//</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">利用</SPAN><SPAN lang=EN-US>AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，将</SPAN><SPAN lang=EN-US>TransactionManager</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和普通的</SPAN><SPAN lang=EN-US>Service</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">编织起来，实现事务。</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="<SPAN style="COLOR: red">org.springframework.transaction.interceptor.TransactionProxyFactoryBean</SPAN>"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="<SPAN style="COLOR: red">proxyInterfaces</SPAN>"&gt;//</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">编织后对外的接口</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;list&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;com.springinaction.training.service.<SPAN style="COLOR: red">CourseService</SPAN>&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/list&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="<SPAN style="COLOR: red">target</SPAN>"&gt;//</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目标</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="<SPAN style="COLOR: red">courseServiceTarget</SPAN>"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="<SPAN style="COLOR: red">transactionManager</SPAN>"&gt;//</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">植入的事务管理者</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="<SPAN style="COLOR: red">transactionManager</SPAN>"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="transactionAttributeSource"&gt;//</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事务的参数（隔离度，方法名等）</SPAN><SPAN lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="attributeSource"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&lt;/bean&gt;</SPAN></P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1683.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-04 14:15 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/04/1683.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring封装Hibernate</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1654.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Thu, 03 Mar 2005 08:58:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1654.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1654.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1654.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1654.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1654.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">封装</SPAN><SPAN lang=EN-US>Hibernate</SPAN>：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有两种手段：</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、使用</SPAN><SPAN lang=EN-US>HibernateTemplate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、继承</SPAN><SPAN lang=EN-US>HibernateDaoSupport</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（实际上，</SPAN><SPAN lang=EN-US>HibernateDaoSupport</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">本身就是对</SPAN><SPAN lang=EN-US>HibernateTemplate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的一个封装）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一切尽在代码中，查看</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">唉！<BR></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>注意：hibernate 2.X和hibernate3.X的区别，我用的是2.X&nbsp;。&nbsp;&nbsp;<IMG height=20 src="http://www.blogjava.net/Emoticons/QQ/45.gif" width=20 border=0><BR>&nbsp;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>package com.company.example.dao;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import java.util.List;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import com.company.example.model.Student;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public interface StudentDao {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public abstract Student getStudent(final Integer id);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public abstract void updateStudent(Student student);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public abstract List findStudentsByLastName(String lastName);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>==================</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>package com.company.example.dao.hibernateImpl;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import java.util.List;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import net.sf.hibernate.Hibernate;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import net.sf.hibernate.HibernateException;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import net.sf.hibernate.Session;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import org.springframework.orm.hibernate.HibernateCallback;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import org.springframework.orm.hibernate.HibernateTemplate;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import com.company.example.dao.StudentDao;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>import com.company.example.model.Student;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public class StudentDaoHibernate implements StudentDao {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>HibernateTemplate hibernateTemplate;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public static void main(String[] args) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public HibernateTemplate getHibernateTemplate() {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return hibernateTemplate;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>this.hibernateTemplate = hibernateTemplate;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public Student getStudent(final Integer id) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return (Student) hibernateTemplate.execute(new HibernateCallback() {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>public Object doInHibernate(Session session)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>throws HibernateException {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return session.load(Student.class, id);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>});<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public Student getStudent2(Integer id) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return (Student) hibernateTemplate.load(Student.class, id);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public void updateStudent(Student student) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>hibernateTemplate.update(student);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>public List findStudentsByLastName(String lastName) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return hibernateTemplate.find("from Student student "<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>+ "where student.lastName = ?", lastName, Hibernate.STRING);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 1pt; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 2.25pt double">
<P class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; MARGIN: 0cm 0cm 0pt; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-padding-alt: 0cm 0cm 1.0pt 0cm; mso-border-bottom-alt: double windowtext 2.25pt" align=left><SPAN lang=EN-US>}</SPAN></P></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">public class StudentDaoHibernate extends HibernateDaoSupport<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">implements StudentDao {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">&nbsp;...........</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">}<BR>======The Spring XML Configuration===========<BR>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<BR>&lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"<BR>"<A href="http://www.springframework.org/dtd/spring-beans.dtd">http://www.springframework.org/dtd/spring-beans.dtd</A>"&gt;<BR>&lt;beans&gt;<BR>&nbsp;&lt;bean id="dataSource"<BR>&nbsp;&nbsp;class="org.springframework.jndi.JndiObjectFactoryBean"&gt;<BR>&nbsp;&nbsp;&lt;property name="jndiName"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;value&gt;java:comp/env/jdbc/trainingDatasource&lt;/value&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&lt;/bean&gt;<BR>&nbsp;<BR>&nbsp;&lt;bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"&gt;<BR>&nbsp;&nbsp;&lt;property name="dataSource"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;ref bean="dataSource"/&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&nbsp;&lt;property name="hibernateProperties"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;props&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;prop key="hibernate.dialect"&gt;net.sf.hibernate.dialect.MySQLDialect&lt;/prop&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/props&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&nbsp;&lt;property name="mappingResources"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;list&gt; &lt;!--list of each hbm.xml--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;Student.hbm.xml&lt;/value&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;Course.hbm.xml&lt;/value&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/list&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&nbsp;&lt;property name="mappingDirectoryLocations"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;list&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--list the directory of the hbm.xml, including each xml file in the dir--&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;classpath:/com/springinaction/training/model&lt;/value&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/list&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&lt;/bean&gt;<BR>&nbsp;<BR>&nbsp;&lt;bean id="hibernateTemplate"<BR>&nbsp;&nbsp;class="org.springframework.orm.hibernate.HibernateTemplate"&gt;<BR>&nbsp;&nbsp;&lt;property name="sessionFactory"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;ref bean="sessionFactory"/&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&lt;/bean&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">&nbsp;&lt;bean id="studentDao" class="com.company.example.dao.hibernateImpl.StudentDaoHibernate"&gt;<BR>&nbsp;&nbsp;&lt;property name="hibernateTemplate"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;ref bean="hibernateTemplate"/&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&lt;/bean&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">&nbsp;&lt;bean id="courseDao" class="com.company.example.dao.hibernateImpl.CourseDaoHibernate"&gt;<BR>&nbsp;&nbsp;&lt;property name="hibernateTemplate"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;ref bean="hibernateTemplate"/&gt;<BR>&nbsp;&nbsp;&lt;/property&gt;<BR>&nbsp;&lt;/bean&gt;<BR>&lt;/beans&gt;</SPAN></P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1654.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-03 16:58 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1654.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring JDBC DAO的两个example</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1647.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Thu, 03 Mar 2005 06:40:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1647.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1647.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1647.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1647.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1647.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;import&nbsp;java.sql.CallableStatement;import&nbsp;java.sql.PreparedStatement;import&nbsp;java.sql.ResultSet;import&nbsp;java.sql.SQLException;import&nbsp;java.sql.Types;import&nbsp;java.uti...&nbsp;&nbsp;<a href='http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1647.html'>阅读全文</a><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1647.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-03 14:40 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1647.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring DAO的哲学</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1644.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Thu, 03 Mar 2005 05:04:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1644.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1644.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1644.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1644.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1644.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">Spring DAO</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">的哲学：</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">封装所有的数据库访问实现，包括</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">JDBC,JDO,Hibernate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">等。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">的异常一般都是</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">RuntimeException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">，数据访问的根异常是</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">，所有的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">的数据访问异常都继承</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">。此外</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">nestedRuntimeException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">子类中，已经将所有的异常栈都进行了记录。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DAO</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">异常对所有底层的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DAO</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">访问实现层的异常进行了统一的封装，并给出了更为有意义的异常。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">CleanupFailureDataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：清除失败异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DataAccessResourceFailureException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：资源访问异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DataIntegrityViolationException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：完整性约束异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DataRetrievalFailureException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：数据获取异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">DeadlockLoserDataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：死锁访问异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">IncorrectUpdateSemanticsDataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：更新出错异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">InvalidDataAccessApiUsageException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：无效数据访问</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">API</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">使用异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">InvalidDataAccessResourceUsageException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：无效数据访问资源使用异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">OptimisticLockingFailureException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：乐观锁失败异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">TypeMismatchDataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：类型匹配失败异常</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">UncategorizedDataAccessException</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-bidi-font-size: 10.5pt">：其他原因异常<BR></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><o:p><BR><BR><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Spring</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Template</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Callback</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">模式完成了对底层实现的统一封装，其中</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Template</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">负责完成那些通用的功能（处理事务、管理资源、处理异常），</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">Callback</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">则完成变化的那部分内容（创建</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">statement</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">、设定参数</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">parameter</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">、生成数据集</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">result</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">）。参考图</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">4.2</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">4.3</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">太重要了。</SPAN></o:p></SPAN></P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1644.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-03 13:04 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1644.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring AOP中的Introduction</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1637.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Thu, 03 Mar 2005 02:49:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1637.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1637.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1637.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1637.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1637.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>Spring AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的</SPAN><SPAN lang=EN-US>Introduction</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正如前面已经提到的，</SPAN><SPAN lang=EN-US>Introduction</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和前面的四个</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是有很大的区别的，</SPAN><SPAN lang=EN-US>introduction</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用于给</SPAN><SPAN lang=EN-US>target</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引入新的接口（例如锁，状态等功能），生成一个</SPAN><SPAN lang=EN-US>mix-in</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的接口。而普通的</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只是在原有接口基础上增加附加内容。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 19pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 9.5pt" align=left><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">Spring</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">中，完成一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">introduction</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">需要三个内容：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">1</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">、将要添加的新接口的定义，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">2</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">、该新接口的实现，在实现的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">class</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">中，必须实现</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">Spring</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">的</SPAN><TT><SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN">IntroductionInterceptor</SPAN></TT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">接口（</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">Spring in action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">原文有误），</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">3</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">、</SPAN><TT><SPAN lang=EN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN">IntroductionAdvisor</SPAN></TT><TT><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 黑体; mso-ascii-font-family: 'Courier New'; mso-ansi-language: EN">接口的实现</SPAN></TT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>public interface IntroductionInterceptor extends MethodInterceptor {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>boolean implementsInterface(Class intf); </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 31.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 3.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>java.lang.Object invoke(MethodInvocation invocation) //</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">此方法来源于</SPAN><SPAN lang=EN-US>MethodInterceptor</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中</SPAN><SPAN lang=EN-US>implementsInterface</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法返回一个</SPAN><SPAN lang=EN-US>boolean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">值，此方法用于判断该</SPAN><SPAN lang=EN-US>introduction</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现是否实现了某个接口――</SPAN><SPAN lang=EN-US>intf</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">参数。所有对</SPAN><SPAN lang=EN-US>intf</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的调用都会转发给</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，由</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法完成相应的任务。下面给出例子（给某个类添加是否</SPAN><SPAN lang=EN-US>auditable</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">功能）：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>public interface Auditable {//1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>auditable</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的定义</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>void setLastModifiedDate(Date date);</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>Date getLastModifiedDate();</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public class AuditableMixin</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>implements <SPAN style="COLOR: red">IntroductionInterceptor</SPAN>, <SPAN style="COLOR: red">Auditable</SPAN> {//2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>auditable</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的实现，同时要实现</SPAN><SPAN lang=EN-US>IntroductionInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">public boolean implementsInterface(Class intf) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">return intf.isAssignableFrom(Auditable.class);<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>// AuditableMixin</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现了</SPAN><SPAN lang=EN-US style="COLOR: red">Auditable</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类的功能</SPAN><SPAN lang=EN-US style="COLOR: red"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">public Object invoke(MethodInvocation m) throws Throwable {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">if (implementsInterface(m.getMethod().getDeclaringClass())) {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">//</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对</SPAN><SPAN lang=EN-US style="COLOR: red">invoke</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的参数</SPAN><SPAN lang=EN-US style="COLOR: red">m</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行判断，当前的调用是否在</SPAN><SPAN lang=EN-US style="COLOR: red">implementsInterface</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">范围内，即，当前的调用是否是</SPAN><SPAN lang=EN-US style="COLOR: red">auditable</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口中的方法？</SPAN><SPAN lang=EN-US style="COLOR: red"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 84pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">return m.getMethod().invoke(this, m.getArguments());<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 84pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">//</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这里的</SPAN><SPAN lang=EN-US style="COLOR: red">this</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就是自己，调用引入的方法（属于</SPAN><SPAN lang=EN-US style="COLOR: red">auditable</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的方法），这样也就给</SPAN><SPAN lang=EN-US style="COLOR: red">target</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">添加了新的</SPAN><SPAN lang=EN-US style="COLOR: red">auditable</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口。</SPAN><SPAN lang=EN-US style="COLOR: red"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">} else {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 84pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">return m.proceed();//</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其他方法的调用。</SPAN><SPAN lang=EN-US style="COLOR: red"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>private Date lastModifiedDate; //</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现</SPAN><SPAN lang=EN-US>auditable</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public Date getLastModifiedDate() {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>return lastModifiedDate;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public void setLastModifiedDate(Date lastModifiedDate) {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>this.lastModifiedDate = lastModifiedDate;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，除了上面直接实现</SPAN><SPAN lang=EN-US>IntroductionInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口之外，还可以通过继承</SPAN><SPAN lang=EN-US>DelegatingIntroductionInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类实现。其中</SPAN><SPAN lang=EN-US>DelegatingIntroductionInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">给出了</SPAN><SPAN lang=EN-US>IntroductionInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口中的两个方法（</SPAN><SPAN lang=EN-US>implementsInterface</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）的默认实现，你仅需要实现</SPAN><SPAN lang=EN-US>auditable</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口即可。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">通过跟踪</SPAN><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">源代码可以发现：</SPAN><SPAN lang=EN-US>DelegatingIntroductionInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US>implementsInterface </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（在</SPAN><SPAN lang=EN-US>IntroductionInfoSupport</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类中）和</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法与上面的代码的形式基本一致。下面是利用</SPAN><SPAN lang=EN-US>DelegatingIntroductionInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">写出的</SPAN><SPAN lang=EN-US>AuditableMixin</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 42pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 4.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>public class AuditableMixin</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>extends <SPAN style="COLOR: red">DelegatingIntroductionInterceptor</SPAN> implements Auditable {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>private Date lastModifiedDate;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public Date getLastModifiedDate() {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>return lastModifiedDate;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public void setLastModifiedDate(Date lastModifiedDate) {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>this.lastModifiedDate = lastModifiedDate;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}<SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 8pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意到一点：上面的两个</SPAN><SPAN lang=EN-US>AuditableMixin</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的实现都仅仅是给</SPAN><SPAN lang=EN-US>Target</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">添加行为，但是未曾改变</SPAN><SPAN lang=EN-US>Target</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的原有行为（因为在</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法的实现中，还是会转发给</SPAN><SPAN lang=EN-US>Target</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）。如果需要改变</SPAN><SPAN lang=EN-US>Target</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的行为<SPAN style="COLOR: red">（例如给</SPAN></SPAN><SPAN lang=EN-US style="COLOR: red">Target</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">增加</SPAN><SPAN lang=EN-US style="COLOR: red">lock</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，一旦处于</SPAN><SPAN lang=EN-US style="COLOR: red">locked</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">状态，那么再调用</SPAN><SPAN lang=EN-US style="COLOR: red">Target</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的方法就会出现异常）</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，这就需要自己写代码修改</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public class ImmutableMixin</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>extends DelegatingIntroductionInterceptor implements Immutable {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>private boolean immutable;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public void setImmutable(boolean immutable) {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>this.immutable = immutable;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">public Object invoke(MethodInvocation mi) throws Throwable {<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">String name = mi.getMethod().getName();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">if (immutable &amp;&amp; name.indexOf("set") == 0) { //这里一旦已经是immutable了，那么就不可以调用setXXX方法了，这也就改变了Target的行为，而不是前面的仅增加接口。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 84pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">throw new IllegalModificationException();<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">return super.invoke(mi);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="COLOR: red">}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的</SPAN><SPAN lang=EN-US>Introduction</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">需要有自己的</SPAN><SPAN lang=EN-US>advisor:</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"> IntroductionAdvisor</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">剩下的也就是和前面一样的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-ansi-language: EN-US; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><FONT face="宋体, MS Song">xml</FONT></SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">文件的编写了。<BR><BR><BR>Spring中使用Introduction需要注意的问题：<BR>&nbsp;&nbsp;&nbsp; 由于Spring使用的是动态AOP,并没有象AspectJ使用静态的代码预编译的方式生成AOP代码，因此只有你从Spring的BeanFactory中得到的Introduction Bean才会已经被introducted，而直接在代码中new出来的target对象则不具有Intorduction功能。 你可以使用一个Factory，封装对Introduction的创建。</SPAN><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1637.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-03 10:49 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/03/1637.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring AOP中的pointcut</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1615.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Wed, 02 Mar 2005 09:33:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1615.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1615.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1615.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1615.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1615.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"><SPAN lang=EN-US>Spring AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的</SPAN><SPAN lang=EN-US>pointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN lang=EN-US>PointCuts</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用于定义所需要“拦截”的</SPAN><SPAN lang=EN-US>class</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">及其</SPAN><SPAN lang=EN-US>method</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。分为静态、动态两种</SPAN><SPAN lang=EN-US>pointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。其中静态</SPAN><SPAN lang=EN-US>pointcuts</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">仅和</SPAN><SPAN lang=EN-US>class name, method name</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">相关，可以在配置文件中通过正则表达式进行部署，因此它们都可以在运行前进行确认。而动态</SPAN><SPAN lang=EN-US>pointcuts</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">则需要考虑到方法的参数，在运行时动态的确认</SPAN><SPAN lang=EN-US>pointcuts</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。一般来说，都是根据</SPAN><SPAN lang=EN-US>method</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US>class</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的名字来进行。其涉及到的接口如下定义：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US>public interface Pointcut {</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ClassFilter getClassFilter();</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>MethodMatcher getMethodMatcher();</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>public interface ClassFilter {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>boolean matches(Class clazz);</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>public interface MethodMatcher {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>boolean matches(Method m, Class targetClass);</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>boolean isRuntime();</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>boolean matches(Method m, Class targetClass, Object[] args);</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">两种静态</SPAN><SPAN lang=EN-US>pointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的实现：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US><FONT color=#008000>NameMatchMethodPointcut</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：只能对方法名进行判别。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US><FONT color=#008000>RegexpMethodPointcut</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：可以对类名、方法名使用正则表达式判别。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">&lt;beans&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="maidServiceTarget"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="com.springinaction.chapter03.cleaning.MaidService"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="queryInterceptor" class="com.springinaction.chapter03.cleaning.QueryInterceptor"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="queryPointcutAdvisor"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="org.springframework.aop.support.RegExpPointcutAdvisor"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="pattern"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;.*get.+By.+&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="advice"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="queryInterceptor"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="maidService"<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class="org.springframework.aop.framework.ProxyFactoryBean"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="proxyInterfaces"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;com.springinaction.chapter03.cleaning.MaidService&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="interceptorNames"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;list&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;queryPointcutAdvisor&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/list&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="target"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value ref="maidServiceTarget"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">&lt;/beans&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: FranklinGothicITCbyBT-DemiItal; mso-hansi-font-family: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">一种动态</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">pointcut</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: FranklinGothicITCbyBT-DemiItal; mso-hansi-font-family: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">的实现：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 19pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.0; mso-char-indent-size: 9.5pt" align=left><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><FONT color=#008000>ControlFlowPointcut</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">：根据当前运行栈的情况，决定当前的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">是否需要被触发。因为它完全基于运行时栈的情况做决策，所以运行速度肯定会变慢。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">&lt;beans&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="myServiceTarget" class="MyServiceImpl"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="servletInterceptor" class="MyServletInterceptor"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="servletPointcut" class="org.springframework.aop.support.ControlFlowPointcut"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;constructor-arg&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;javax.servlet.http.HttpServlet&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/constructor-arg&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="servletAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="advice"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="servletInterceptor"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="pointcut"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;ref bean="servletPointcut"/&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;bean id="service" class="org.springframework.aop.framework.ProxyFactoryBean"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="proxyInterfaces"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;MyService&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="interceptorNames"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;list&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value&gt;servletAdvisor&lt;/value&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/list&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;property name="target"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;value ref="myServiceTarget"&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/property&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/bean&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: FranklinGothicITCbyBT-DemiItal; mso-font-kerning: 0pt">&lt;/beans&gt;<o:p></o:p></SPAN></P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1615.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-02 17:33 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1615.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SpringAOP中的advisor</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1614.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Wed, 02 Mar 2005 09:32:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1614.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1614.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1614.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1614.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1614.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-ansi-language: EN">SpringAOP中的advisor：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt; mso-layout-grid-align: none"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">前面已经提到，</SPAN><SPAN lang=EN-US>advisor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是是</SPAN><SPAN lang=EN-US>PointCut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US>Advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的综合体，完整描述了一个</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将会在</SPAN><SPAN lang=EN-US>pointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所定义的位置被触发。也就是说，它包含了</SPAN><SPAN lang=EN-US>pointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">两项内容，这两项内容则用于分别给出</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">调用所发生的位置和发生的内容。其接口如下：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public interface PointcutAdvisor {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>Pointcut getPointcut();</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>Advice getAdvice();</SPAN></P><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">}</SPAN><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1614.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-02 17:32 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1614.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring AOP中的四个Advice</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1612.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Wed, 02 Mar 2005 09:31:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1612.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1612.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1612.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1612.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1612.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-layout-grid-align: none; tab-stops: list 18.0pt; mso-list: l3 level1 lfo7" align=left><SPAN lang=EN-US>1、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>around advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：所有</SPAN><SPAN lang=EN-US>around advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">必须实现</SPAN><SPAN lang=EN-US>MethodInterceptor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，注意</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法的参数</SPAN><SPAN lang=EN-US>invocation</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US>MethodInvocation</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，在此中包含了许多信息，包括其所封装的方法及其参数，</SPAN><SPAN lang=EN-US>AOP proxy</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Jointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public interface MethodInterceptor extends Interceptor {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Object invoke(MethodInvocation invocation) throws Throwable;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在实现</SPAN><SPAN lang=EN-US>around advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，和</SPAN><SPAN lang=EN-US>before advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>after advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有着两个很大的区别：</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、必须在</SPAN><SPAN lang=EN-US>invoke</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法中调用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">MethodInvocation.proceed()</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">，这样才能将所有调用延续下去，调用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">target</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">对象的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">method</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">；</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">2</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">、必须自己返回一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">object</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">，该</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">object</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">甚至可以与</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">target’s method</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">的返回值不一样。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-layout-grid-align: none; tab-stops: list 18.0pt; mso-list: l3 level1 lfo7" align=left><SPAN lang=EN-US>2、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>before advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在</SPAN><SPAN lang=EN-US>jointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">执行之前，运行</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。必须实现</SPAN><SPAN lang=EN-US>MethodBeforeAdvice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public interface MethodBeforeAdvice extends BeforeAdvice {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>void before(Method m, Object[] args, Object target) throws Throwable;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-layout-grid-align: none; tab-stops: list 18.0pt; mso-list: l3 level1 lfo7" align=left><SPAN lang=EN-US>3、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>after advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在</SPAN><SPAN lang=EN-US>jointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">执行之后，运行</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。必须实现</SPAN><SPAN lang=EN-US>AfterReturningAdvice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>public interface AfterReturningAdvice extends Advice {</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>void afterReturning(Object returnValue, Method m, Object[] args, Object target) </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>throws Throwable;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-layout-grid-align: none; tab-stops: list 18.0pt; mso-list: l3 level1 lfo7" align=left><SPAN lang=EN-US>4、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>throws advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在</SPAN><SPAN lang=EN-US>jointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">执行出现异常的时候，运行此</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。必须实现</SPAN><SPAN lang=EN style="mso-ansi-language: EN">ThrowsAdvice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口。但是此接口只是一个标识接口，必须实现此外实现下面的方法：</SPAN><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 42pt; TEXT-ALIGN: left; mso-char-indent-count: 4.0; mso-char-indent-size: 10.5pt; mso-layout-grid-align: none" align=left><SPAN lang=EN style="mso-ansi-language: EN">afterThrowing([Method], [args], [target], subclassOfThrowable)<o:p></o:p></SPAN></P><SPAN lang=EN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">此外，在</SPAN><SPAN lang=EN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">jointcut</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">出现异常时，具体调用哪个</SPAN><SPAN lang=EN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">afterThrowing</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">方法，这就涉及到类型判别，最符合类型判别的将会被调用。</SPAN><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1612.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-02 17:31 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1612.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring  AOP 概念</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1611.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Wed, 02 Mar 2005 09:30:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1611.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1611.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1611.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1611.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1611.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt; mso-pagination: widow-orphan; mso-layout-grid-align: none" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">切面（</SPAN><SPAN lang=EN-US>Aspect</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）：对象操作过程中的截面，也就是某方面的任务，例如事务、日志。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt; mso-layout-grid-align: none"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">连接点（</SPAN><SPAN lang=EN-US>JoinPoint</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）：程序运行过程中的某个阶段点。如某个方法调用，或者某个异常被抛出。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt; mso-layout-grid-align: none"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">处理逻辑（</SPAN><SPAN lang=EN-US>Advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）：在某个连接点所采用的处理逻辑。处理逻辑的调用模式通常有三种：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-layout-grid-align: none; tab-stops: list 36.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Verdana; mso-hansi-font-family: 'Times New Roman'">i.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN lang=EN-US>Around</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在连接点前后插入预处理过程和后处理过程。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-layout-grid-align: none; tab-stops: list 36.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Verdana; mso-hansi-font-family: 'Times New Roman'">ii.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN lang=EN-US>Before</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：仅在连接点之前插入预处理过程。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-layout-grid-align: none; tab-stops: list 36.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Verdana; mso-hansi-font-family: 'Times New Roman'">iii.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN lang=EN-US>After</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在连接点之后进行处理。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-layout-grid-align: none; tab-stops: list 36.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Verdana; mso-hansi-font-family: 'Times New Roman'">iv.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 7pt">&nbsp;&nbsp;&nbsp; </SPAN><SPAN lang=EN-US>Throw</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在连接点抛出异常时进行异常处理。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt; mso-layout-grid-align: none"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">切点（</SPAN><SPAN lang=EN-US>PointCut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）：一系列连接点的集合，它指明处理方式（</SPAN><SPAN lang=EN-US>Advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）将在何处被触发，可以使用正则表达式表达。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt; mso-layout-grid-align: none"><SPAN lang=EN-US>Advisor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：是</SPAN><SPAN lang=EN-US>PointCut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US>Advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的综合体，完整描述了一个</SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将会在</SPAN><SPAN lang=EN-US>pointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所定义的位置被触发。</SPAN></P><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Introduction</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">：为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">advised object</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">加上一定的方法或者数据成员。与</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Advice</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">属于并列的概念，但有着一定的区别。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Advice</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">只是给</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">target</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">附加上其他的功能，使用者甚至可以觉察不到，但是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Introduction</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">则添加了其他的功能，例如给</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">target</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">赋予了</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">lock</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">功能，状态等。</SPAN><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1611.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-02 17:30 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1611.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring的配置文件</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1603.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Wed, 02 Mar 2005 03:48:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1603.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1603.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1603.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1603.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1603.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的配置文件</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l1 level1 lfo5; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">1、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于那些使用到有限外部资源的</SPAN><SPAN lang=EN-US>bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，无非必要，请尽量使其</SPAN><SPAN lang=EN-US>singleton</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l1 level1 lfo5; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>2、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">init-method</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">Bean</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">创建开始时调用，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">destory-method</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">在销毁时调用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">.Spring</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">自己提供了</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">InitializingBean</SPAN><SPAN style="FONT-SIZE: 9.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Courier; mso-hansi-font-family: Courier; mso-font-kerning: 0pt">，</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">DisposableBean</SPAN><SPAN lang=EN-US style="FONT-FAMILY: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: NewBaskervilleITCbyBT-Roman; mso-hansi-font-family: NewBaskervilleITCbyBT-Roman; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt">这两个接口完成这两个功能，一</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">旦</SPAN><SPAN lang=EN-US>Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象实现了这两个接口，则无需进行任何配置，容器就会实现这两个功能。（当然，这也就使得你的应用和</SPAN><SPAN lang=EN-US>Spring API</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">捆绑到了一起）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l1 level1 lfo5; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>3、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>Innner Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：这样的配置使得</SPAN><SPAN lang=EN-US>inner bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只能被</SPAN><SPAN lang=EN-US>wrapper bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所引用。这点在</SPAN><SPAN lang=EN-US>AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中尤其有用：</SPAN><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只能访问</SPAN><SPAN lang=EN-US>AOProxy</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，而不能直接得到</SPAN><SPAN lang=EN-US>AOProxy</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所封装的</SPAN><SPAN lang=EN-US>target object</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l1 level1 lfo5; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>4、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">集合元素</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-layout-grid-align: none" align=center><SPAN lang=EN-US>&lt;list&gt; </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-char-type: symbol; mso-symbol-font-family: Wingdings"><SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">à</SPAN></SPAN><SPAN lang=EN-US>java.awt.List, arrays</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-layout-grid-align: none" align=center><SPAN lang=EN-US>&lt;set&gt; </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-char-type: symbol; mso-symbol-font-family: Wingdings"><SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">à</SPAN></SPAN><SPAN lang=EN-US>java.awt.Set</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-layout-grid-align: none" align=center><SPAN lang=EN-US>&lt;map&gt; </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-char-type: symbol; mso-symbol-font-family: Wingdings"><SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">à</SPAN></SPAN><SPAN lang=EN-US>java.awt.Map</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-layout-grid-align: none" align=center><SPAN lang=EN-US>&lt;props&gt; </SPAN><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-char-type: symbol; mso-symbol-font-family: Wingdings"><SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">à</SPAN></SPAN><SPAN lang=EN-US>java.awt.Properties</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l1 level1 lfo5; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>5、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设置空值：</SPAN><SPAN lang=EN-US>&lt;property name="foo"&gt;&lt;null/&gt;&lt;property&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l1 level1 lfo5; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>6、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">构造函数注入：用于那些必须的、</SPAN><SPAN lang=EN-US>final</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的参数。如果构造函数的参数可能引起冲突，可以在配置文件中给各参数加上</SPAN><SPAN lang=EN-US>type</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo5; tab-stops: list 18.0pt; mso-layout-grid-align: none"><SPAN lang=EN-US>7、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>autowiring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：它会带来一定的问题，因为无论如何</SPAN><SPAN lang=EN-US>autowiring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，都无法保证其结果一定正确，很可能会出现许多与预期不一致的地方。</SPAN></P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1603.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-02 11:48 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1603.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring中Container管理Bean</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1602.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Wed, 02 Mar 2005 02:36:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1602.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1602.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1602.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1602.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1602.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，含有两个重要的</SPAN><SPAN lang=EN-US>Container</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，用于管理这些</SPAN><SPAN lang=EN-US>javabean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">他们是</SPAN><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US>ApplicationContext</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。其中</SPAN><SPAN lang=EN-US>ApplicationContext</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">继承了</SPAN><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的所有功能，还提供了</SPAN><SPAN lang=EN-US>i18n</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、统一载入资源、事件分发等功能。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，所有的</SPAN><SPAN lang=EN-US>bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的创建都是</SPAN><SPAN lang=EN-US>lazy</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的，包括那些</SPAN><SPAN lang=EN-US>singleton bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。只有</SPAN><SPAN lang=EN-US>javabean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象必须被使用的时候，才会创建该对象，才会正式的解析相应的</SPAN><SPAN lang=EN-US>xml</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">标记，解析该</SPAN><SPAN lang=EN-US>bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US>property</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等。但是在</SPAN><SPAN lang=EN-US>ApplicationContext</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，它可以预先载入</SPAN><SPAN lang=EN-US>sigleton bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，而不是直到使用时才创建。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes"></SPAN></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">最常用的实现是</SPAN><SPAN lang=EN-US>XmlBeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，载入“定位</SPAN><SPAN lang=EN-US>xml</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”文件：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 31.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 3.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>BeanFactory factory = new XmlBeanFactory(new FileInputStream("beans.xml"));</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 31.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 3.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>ApplicationContext</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">有三种实现：</SPAN><SPAN lang=EN-US>ClassPathXmlApplicationContext</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US>FileSystemXmlApplicationContext</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US>XmlWebApplicationContext</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。其中前两者也是基于路径的，和</SPAN><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US>xml</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件定位方式一致。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 31.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 3.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>ApplicationContext context =new FileSystemXmlApplicationContext("c:/foo.xml");</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 31.5pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 3.0; mso-char-indent-size: 10.5pt" align=left><SPAN lang=EN-US>ApplicationContext context = new ClassPathXmlApplicationContext("foo.xml");</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">管理</SPAN><SPAN lang=EN-US>Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的生命周期：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>1、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用构造函数创建</SPAN><SPAN lang=EN-US>Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>2、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象</SPAN><SPAN lang=EN-US>autowire</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被执行</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>3、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US>Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象调用各项</SPAN><SPAN lang=EN-US>setXXX</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>4、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果该</SPAN><SPAN lang=EN-US>Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现了</SPAN><SPAN lang=EN-US>BeanNameAware</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，则调用该对象的</SPAN><SPAN lang=EN-US>setBeanName()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，设置其</SPAN><SPAN lang=EN-US>ID</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（已经在</SPAN><SPAN lang=EN-US>xml</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置文件中写好了）</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>5、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果该</SPAN><SPAN lang=EN-US>Bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现了</SPAN><SPAN lang=EN-US>BeanFactoryAware</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，则调用该对象的</SPAN><SPAN lang=EN-US>setBeanFactory()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，传入</SPAN><SPAN lang=EN-US>BeanFactory</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象自身</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>6、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果已经配置了</SPAN><SPAN lang=EN-US>BeanPostProcessor</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，那么调用</SPAN><SPAN lang=EN-US>BeanPostProcessors</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US>pre-</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>ProcessBeforeInitialization()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，对该Bean对象进行处理；</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>7、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果该</SPAN><SPAN lang=EN-US>bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">自定义了</SPAN><SPAN lang=EN-US>init()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，那么调用此方法</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>8、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;<FONT size=3><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果已经配置了</SPAN><SPAN lang=EN-US>BeanPostProcessor</SPAN></FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，那么调用该</SPAN><SPAN lang=EN-US>BeanPostProcessors</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US>post</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>ProcessBeforeInitialization()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，对该Bean对象进行处理</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>9、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正常使用</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>10、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">系统销毁，如果该</SPAN><SPAN lang=EN-US>bean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象实现了</SPAN><SPAN lang=EN-US>DisposableBean</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，则调用其</SPAN><SPAN lang=EN-US>destory()</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，</SPAN><SPAN lang=EN-US> </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l0 level1 lfo4; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US>11、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">最后调用用户在配置文件中编写的</SPAN><SPAN lang=EN-US>destroy-method</SPAN></P>
<P>&nbsp;</P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1602.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-02 10:36 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/02/1602.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Sping Live笔记一</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/03/01/1595.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Tue, 01 Mar 2005 09:39:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/03/01/1595.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1595.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/03/01/1595.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1595.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1595.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>&nbsp;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">整个</SPAN><SPAN lang=EN-US>Web</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用分为四部分</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN lang=EN-US>1、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">单独的</SPAN><SPAN lang=EN-US style="COLOR: red">DAO</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，负责数据访问，执行</SPAN><SPAN lang=EN-US style="COLOR: red">CUID</SPAN><SPAN lang=EN-US>(create, update, insert ,delete)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，<SPAN style="COLOR: red">完成</SPAN></SPAN><SPAN lang=EN-US style="COLOR: red">O/R</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">映射</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。不涉及任何的其他逻辑，仅执行这以上的操作，如果有唯一性检查、事务也不需要做。（可以在数据库端加一些</SPAN><SPAN lang=EN-US>trigger,constraint</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）。<SPAN style="COLOR: red">该层需要定义</SPAN></SPAN><SPAN lang=EN-US style="COLOR: red">DAO</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，</SPAN><SPAN lang=EN-US style="COLOR: red">DAO</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现</SPAN><SPAN lang=EN-US style="COLOR: red">(hibernate</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US style="COLOR: red">ibaits</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US style="COLOR: red">JDBC</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等</SPAN><SPAN lang=EN-US style="COLOR: red">)</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN lang=EN-US>2、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">简单的</SPAN><SPAN lang=EN-US style="COLOR: red">Logic Object</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（</SPAN><SPAN lang=EN-US style="COLOR: red">Java Bean</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">），</SPAN><SPAN lang=EN-US style="COLOR: red">data field+setter+getter+Other Logic</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，可以将一些共有的操作提取到父类中，减少代码。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN lang=EN-US>3、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="COLOR: red">Business Sevice</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，实现业务逻辑，在此使用</SPAN><SPAN lang=EN-US style="COLOR: red">DAO</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US style="COLOR: red">Logic Object</SPAN><SPAN style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">完成业务操作。</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这里当使用到</SPAN><SPAN lang=EN-US>DAO</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，只需要</SPAN><SPAN lang=EN-US>IOC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注入，真实对象由外界（</SPAN><SPAN lang=EN-US>Web</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">容器调用</SPAN><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">容器）注入。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN lang=EN-US>4、<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">编写</SPAN><SPAN lang=EN-US>Action</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，将用户界面的操作映射到</SPAN><SPAN lang=EN-US>Busibess service</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN><SPAN lang=EN-US>Spring MVC</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的具体配置：</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; TEXT-ALIGN: left; mso-list: l2 level1 lfo3; tab-stops: list 18.0pt; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">1、</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">在</SPAN><I><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman,Italic; mso-font-kerning: 0pt">web.xml</SPAN></I><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: 'TimesNewRoman,Italic'; mso-hansi-font-family: 'TimesNewRoman,Italic'">中</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">, </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">增加</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">dispatcher</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">的定义，配置好</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">URL Mapping</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">分发用户调用。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;servlet&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;servlet-name&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">action</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/servlet-name&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;servlet-class&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 105pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">org.springframework.web.servlet.DispatcherServlet<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/servlet-class&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;load-on-startup&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">1</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/load-on-startup&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1"></SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/servlet&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;servlet-mapping&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;servlet-name&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">action</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/servlet-name&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1"></SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;url-pattern&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">*.html</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/url-pattern&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/servlet-mapping&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN style="FONT-SIZE: 10pt; COLOR: #7f007f; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">编写相应的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">action-servlet.xml<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">2</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">、如果使用了多个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">context</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">文件（</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">Spring</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">的配置文件），则需要在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">Web.xml</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">中进行配置，具体如下：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&lt;</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: CourierNewPS-BoldMT; mso-font-kerning: 0pt">context-param</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&lt;</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: CourierNewPS-BoldMT; mso-font-kerning: 0pt">param-name</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">contextConfigLocation</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&lt;/</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: CourierNewPS-BoldMT; mso-font-kerning: 0pt">param-name</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&lt;</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: CourierNewPS-BoldMT; mso-font-kerning: 0pt">param-value</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">/WEB-INF/applicationContext1.xml<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">/WEB-INF/applicationContext2.xml<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&lt;/</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: CourierNewPS-BoldMT; mso-font-kerning: 0pt">param-value</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&lt;/</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: CourierNewPS-BoldMT; mso-font-kerning: 0pt">context-param</SPAN></B><SPAN lang=EN-US style="FONT-SIZE: 11pt; COLOR: #000081; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">其位置在“</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">sitemesh filter</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">”之后，但是在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">filter-mapping</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">之前。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">&nbsp;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt">3. </SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: TimesNewRoman; mso-hansi-font-family: TimesNewRoman">增加</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: CourierNewPSMT; mso-font-kerning: 0pt">ContextLoaderListener</SPAN><SPAN lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: Courier; mso-font-kerning: 0pt">.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: TimesNewRoman; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;listener&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;listener-class&gt;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.1; mso-char-indent-size: 10.0pt" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">org.springframework.web.context.ContextLoaderListener<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none; mso-char-indent-count: 2.1; mso-char-indent-size: 10.0pt" align=left><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/listener-class&gt;</SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: #7f007f; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt; mso-highlight: white">&lt;/listener&gt;</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN></P>
<P>对照了Spring in action,那个讲的更好哦。从spring的基础开始讲起，很不错。</P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1595.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-03-01 17:39 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/03/01/1595.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring利用dynamic proxy实现AOP</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1378.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Sun, 20 Feb 2005 14:17:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1378.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1378.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1378.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1378.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1378.html</trackback:ping><description><![CDATA[quote="firebody" ] <BR>至于上面所说的动态代理，给你一个更简单的说法，比如Spring里的TransactionProxyFactoryBean，他是对支持事务管理的一个代理FactoryBean，利用动态代理，这个类可以不依赖于具体的target 接口，用户可以随意选择target 接口。也不需要用户再手工根据自己的target 接口扩展一个TransactionProxyFactoryBean。 这样的一个用到java.lang.reflect的动态代理机制，使得用户需要编写的代码量大大减小，也使得整个框架配置使用趋于一致。[/quote] <BR><BR><BR>
<TABLE cellSpacing=1 cellPadding=3 width="90%" align=center border=0>
<TBODY>
<TR>
<TD><SPAN class=genmed><B>java代码:&nbsp;</B></SPAN></TD></TR>
<TR>
<TD class=code>
<DIV style="FONT-FAMILY: 'Courier New', Courier, monospace"><BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;bean id="someObjectProxy" <SPAN style="FONT-WEIGHT: bold; COLOR: #990066" ?>class</SPAN>="org.<SPAN style="COLOR: #000000">springframework</SPAN>.<SPAN style="COLOR: #000000">aop</SPAN>.<SPAN style="COLOR: #000000">framework</SPAN>.<SPAN style="COLOR: #000000">ProxyFactoryBean</SPAN>"&gt; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="proxyInterfaces"&gt;&nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;ISomeInterface&lt;/value&gt;&nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/property&gt;&nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="target"&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ref bean="someObject"/&gt;&nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/property&gt;&nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name="interceptorNames"&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;list&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;value&gt;lockMixinAdvisor&lt;/value&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/list&gt;&nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/property&gt;&nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/bean&gt; <BR></DIV><BR></TD></TR></TBODY></TABLE><SPAN class=postbody><BR><BR><BR>我奇怪的是，既然有下面这个， <BR></SPAN>
<TABLE cellSpacing=1 cellPadding=3 width="90%" align=center border=0>
<TBODY>
<TR>
<TD><SPAN class=genmed><B>java代码:&nbsp;</B></SPAN></TD></TR>
<TR>
<TD class=code>
<DIV style="FONT-FAMILY: 'Courier New', Courier, monospace"><BR><BR>&lt;bean id="someObjectProxy" <SPAN style="FONT-WEIGHT: bold; COLOR: #990066" ?>class</SPAN>="org.<SPAN style="COLOR: #000000">springframework</SPAN>.<SPAN style="COLOR: #000000">aop</SPAN>.<SPAN style="COLOR: #000000">framework</SPAN>.<SPAN style="COLOR: #000000">ProxyFactoryBean</SPAN>"&gt; <BR></DIV><BR></TD></TR></TBODY></TABLE><SPAN class=postbody><BR><BR>那么程序代码中， 怎么可以这样写？ <BR></SPAN>
<TABLE cellSpacing=1 cellPadding=3 width="90%" align=center border=0>
<TBODY>
<TR>
<TD><SPAN class=genmed><B>java代码:&nbsp;</B></SPAN></TD></TR>
<TR>
<TD class=code>
<DIV style="FONT-FAMILY: 'Courier New', Courier, monospace"><BR><BR>ISomeInterface someObjectProxy = <SPAN style="COLOR: #000000">(</SPAN>ISomeInterface<SPAN style="COLOR: #000000">)</SPAN> context <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<SPAN style="COLOR: #000000">getBean</SPAN><SPAN style="COLOR: #000000">(</SPAN>"someObjectProxy"<SPAN style="COLOR: #000000">)</SPAN>; <BR></DIV><BR></TD></TR></TBODY></TABLE><SPAN class=postbody>
<P><BR>注意，这里返回的是ISomeInterface ，而且这个someObjectProxy 对象已经具有了ILock＋ISomeInterface 的功能，并且在行为表现的完全和ISomeInterface 一致。 <BR><BR>如果Spring的代码是预编译的，那可以产生stub之类的，可这里是怎么实现的，挺让人奇怪哦，谁能解释一下么？ </P>
<P>答案 ： <A href="http://www.javajia.com/article.php?id=919">http://www.javajia.com/article.php?id=919</A></P>
<P><BR>只是在这上面再封装的完美罢了，好好研究dynamic proxy的实现吧。</P>
<P><BR>此外，还有这一段哦 ：） <BR><BR>AOP的作用可以简单如下所说：“在一个组件的前后加上一些固定的内容。” 抛开AOP不说，我们自己如果想要写这东西，无非两种方式，一个是proxy实现，然后在proxy的前后添加内容；还有一种就是template实现。 <BR>所以在我看来，数据库层的模板其实也算是一种“AOP”。 不知道有没人对此有些意见和评述？ <BR></P></SPAN><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1378.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-02-20 22:17 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1378.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring IDE的使用</title><link>http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1372.html</link><dc:creator>jinfeng_wang</dc:creator><author>jinfeng_wang</author><pubDate>Sun, 20 Feb 2005 08:25:00 GMT</pubDate><guid>http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1372.html</guid><wfw:comment>http://www.blogjava.net/jinfeng_wang/comments/1372.html</wfw:comment><comments>http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1372.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jinfeng_wang/comments/commentRss/1372.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jinfeng_wang/services/trackbacks/1372.html</trackback:ping><description><![CDATA[<P>下载了spring ide, 其具体的使用方法。</P>
<H2>Usage </H2>
<H2><A name=usage-fresh></A>Fresh Installation</H2>
<OL>
<LI>Add Spring Beans project nature 
<UL>
<LI>select open project nodes in Eclipse resource navigator， or JDT package explorer 
<LI>&nbsp;在Eclipse的resource navigator窗口中打开项目，（或者在 JDT package explorer窗口） 
<LI>activate context menu item "Add Spring Beans Project Nature" on selected projects -&gt; these projects are now decorated with a small 'S' in the upper right corner (overwriting other decorators, e.g. Java project decorator 'J')&nbsp; 
<LI>在所打开的项目中，右键项目名，选择“Add Spring Beans Project Nature”，这时该项目就会在右上角挂上了“S”. :) </LI></UL>
<LI>Add references to other Spring projects 
<UL>
<LI>open project's properties dialog in Eclipse resource navigator or JDT package explorer&nbsp; 
<LI>&nbsp;右键项目名，查看其properties,这就打开了"project properties"窗口 
<LI>select the properties page "Project References" from the list&nbsp; 
<LI>&nbsp;这时就可以选择 "Project References"</LI></UL>
<UL>
<LI>select Spring project(s) containing Spring Beans config files which are referenced from within in this project's Spring Beans config sets&nbsp; 
<LI>选择&nbsp;所依赖引用的项目</LI></UL>
<LI>Add Spring Beans factory config files 
<UL>
<LI>open project's properties dialog in Eclipse resource navigator or JDT package explorer or via double-clicking a project in the Spring Beans view 
<LI>同样，再次打开项目的属性对话框，或者也可以打开“Spring Beans View”(这个窗口可以在window-&gt;slow view里面打开) 
<LI>select the properties page "Spring Beans Project" from the list 
<LI>在项目的属性窗口中选择"Spring Beans Project" 
<LI>use button "Add..." to open a selector dialog and select all Spring Beans config files -&gt; added Spring Beans config files are decorated with a small 'S' in the upper right corner 
<LI>通过“Add”按钮选择Spring配置文件。 
<LI>(optionally) combine config files into config sets with the second tab of the property page (use "New..." to create a new config set and select the config files; use "Move Up" and "Move Down" to change the order of the config files) </LI></UL>
<LI>Open Spring Beans view 
<UL>
<LI>select from within any of the added Spring Beans config files opened in an Eclipse editor the menu item "Navigate/Show In/Spring Beans" -&gt; Spring Beans view is opened and the corresponding Spring Beans config file is selected in the view's model 
<LI>&nbsp;Double clicking on an entry in the view navigates to the corresponding location in the config file </LI></UL>
<LI>Validate Spring Beans config file 
<UL>
<LI>save any of the added Spring Beans config files from within an open Eclipse editor -&gt; all errors occured during validation create a problem marker in Eclipse's task view 
<LI>保存Spring配置文件，这时就可以看到错误了 （俺没有能够在task窗口中看到，但在Bean.xml文件的编辑窗口看到了，嘻嘻～～～） 
<LI>另外，可以观察一下"Spring beans"那个窗口，在其上面有三个按钮，第三个是"show in property sheet", 这个功能不错哦，可以试一下。当然了，直接看xml文件也是挺好的。</LI></UL></LI></OL>
<P>6、非常好的一个功能，在Spring Beans那个窗口中添加好你的Spring配置文件之后，在其中右键你的配置文件，选择“show graph”，it's such a wonderful function~~~~</P>
<P>在线安装地址： &nbsp;<A href="http://springframework.sourceforge.net/spring-ide/eclipse/updatesite/">http://springframework.sourceforge.net/spring-ide/eclipse/updatesite/</A>.&nbsp; </P>
<P>注意哦，在安装的时候，一定要选“Spring framework”,然后才可以装“Spring IDE”(就是Beans Configuration Support啦。)</P>
<P>&nbsp;</P><img src ="http://www.blogjava.net/jinfeng_wang/aggbug/1372.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jinfeng_wang/" target="_blank">jinfeng_wang</a> 2005-02-20 16:25 <a href="http://www.blogjava.net/jinfeng_wang/archive/2005/02/20/1372.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>