﻿<?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-Tom Xu</title><link>http://www.blogjava.net/Tomshi-Xu/</link><description /><language>zh-cn</language><lastBuildDate>Mon, 13 Apr 2026 09:06:11 GMT</lastBuildDate><pubDate>Mon, 13 Apr 2026 09:06:11 GMT</pubDate><ttl>60</ttl><item><title>sql 语法 stuff</title><link>http://www.blogjava.net/Tomshi-Xu/archive/2013/02/24/395642.html</link><dc:creator>Tom Xu</dc:creator><author>Tom Xu</author><pubDate>Sun, 24 Feb 2013 03:21:00 GMT</pubDate><guid>http://www.blogjava.net/Tomshi-Xu/archive/2013/02/24/395642.html</guid><wfw:comment>http://www.blogjava.net/Tomshi-Xu/comments/395642.html</wfw:comment><comments>http://www.blogjava.net/Tomshi-Xu/archive/2013/02/24/395642.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Tomshi-Xu/comments/commentRss/395642.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Tomshi-Xu/services/trackbacks/395642.html</trackback:ping><description><![CDATA[<p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">1、作用<br />删除指定长度的字符，并在指定的起点处插入另一组字符。</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">2、语法<br />STUFF ( character_expression , start , length ,character_expression )</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">3、示例<br />以下示例在第一个字符串 abcdef 中删除从第 2 个位置（字符 b）开始的三个字符，然后在删除的起始位置插入第二个字符串，从而创建并返回一个字符串SELECT STUFF('abcdef', 2, 3, 'ijklmn')<br />GO</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">下面是结果集<br />aijklmnef</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">4、参数<br />character_expression<br />一个字符数据表达式。character_expression 可以是常量、变量，也可以是字符列或二进制数据列。</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">start<br />一个整数值，指定删除和插入的开始位置。如果 start 或 length 为负，则返回空字符串。如果 start 比第一个 character_expression长，则返回空字符串。start 可以是 bigint 类型。</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">length<br />一个整数，指定要删除的字符数。如果 length 比第一个 character_expression长，则最多删除到最后一个 character_expression 中的最后一个字符。length 可以是 bigint 类型。</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">5、返回类型<br />如果 character_expression 是受支持的字符数据类型，则返回字符数据。如果 character_expression 是一个受支持的 binary 数据类型，则返回二进制数据。</p><p style="font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19px; text-align: left; background-color: #ffffff; ">6、备注<br />如果结果值大于返回类型支持的最大值，则产生错误。<br />（资料来源于网络）<br /><br /></p><img src ="http://www.blogjava.net/Tomshi-Xu/aggbug/395642.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Tomshi-Xu/" target="_blank">Tom Xu</a> 2013-02-24 11:21 <a href="http://www.blogjava.net/Tomshi-Xu/archive/2013/02/24/395642.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring 学习笔记（实例化方式 spring bean作用域 spring依赖注入 spring自动扫描 spring和struts整合步骤）</title><link>http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390767.html</link><dc:creator>Tom Xu</dc:creator><author>Tom Xu</author><pubDate>Sun, 04 Nov 2012 14:43:00 GMT</pubDate><guid>http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390767.html</guid><wfw:comment>http://www.blogjava.net/Tomshi-Xu/comments/390767.html</wfw:comment><comments>http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390767.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Tomshi-Xu/comments/commentRss/390767.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Tomshi-Xu/services/trackbacks/390767.html</trackback:ping><description><![CDATA[<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><strong><font size="4"></font></strong>&nbsp;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><strong><font size="3">spring bean 实例化的方式</font></strong></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><strong>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</strong><span style="font-size: 14px">1.默认情况下是调用bean对象的默认构造函数来示例话bean</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; 2.调用工厂的静态方法来实例化bean</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;bean id="bean实例name" class="工厂类" factory-method="工厂的静态方法"&gt;&lt;/bean&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; 3.调用工厂方法来实例化bean</span></div><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bean id="工厂实例name" class="工厂类" &nbsp;class="工厂类名"&gt;</span><br style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bean id="bean实例name" factory-name="工厂实例name",factory-method="工厂的非静态方法"&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><font size="3"><strong>spring bean 的作用域 (可以使用scope="singleton/prototype/request/session/global session"来配置)</strong></font></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 1.默认作用域（singleton）情况下：</span></div>
<blockquote style="border-bottom-style: none; padding-bottom: 0px; widows: 2; text-transform: none; text-indent: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px 微软雅黑; white-space: normal; orphans: 2; border-top-style: none; color: rgb(0,0,0); border-right-style: none; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-image: initial">
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; bean的实例化是在容器实例化（被主动申请加载）时就实例化</span></div>
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; 将lazy-init="true" (延迟初始化) 不会再容器实例化实例化bean (不建议使用)</span></div>
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; 用init-method="methodName" 可以指定bean被实例化时调用的方法</span></div>
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; 用destory-method="methodName" 可以制定容器调用close方法后bean执行的方法</span></div></blockquote><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.配置prototype（原型）作用域：</span><br style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<blockquote style="border-bottom-style: none; padding-bottom: 0px; widows: 2; text-transform: none; text-indent: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px 微软雅黑; white-space: normal; orphans: 2; border-top-style: none; color: rgb(0,0,0); border-right-style: none; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-image: initial">
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp;bean的实例化是在调用getBean方法时被实例化的</span></div>
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp;每次调用一个getBean方法都回返回一个新的对象</span></div>
<div><span style="font-size: 14px"><br /></span></div></blockquote>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><font size="3"><strong>Spring Dependency Injection(Spring的依赖注入)</strong></font></div><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;1</span><strong style="line-height: normal; widows: 2; text-transform: none; font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); font-size: 14px; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">.</strong><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">使用映射的方式注入</span><br style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<blockquote style="border-bottom-style: none; padding-bottom: 0px; widows: 2; text-transform: none; text-indent: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px 微软雅黑; white-space: normal; orphans: 2; border-top-style: none; color: rgb(0,0,0); border-right-style: none; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-image: initial">
<blockquote style="border-bottom-style: none; padding-bottom: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; padding-right: 0px; border-top-style: none; border-right-style: none; padding-top: 0px; border-image: initial">
<div><span style="font-size: 14px">&lt;bean id="personDao" class="接口实现类路径"&gt;&lt;/bean&gt; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span></div></blockquote>
<blockquote style="border-bottom-style: none; padding-bottom: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; padding-right: 0px; border-top-style: none; border-right-style: none; padding-top: 0px; border-image: initial">
<div><span style="font-size: 14px">&lt;bean id="persionService" class="接口实现的类路径"&gt;</span></div></blockquote>
<blockquote style="border-bottom-style: none; padding-bottom: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; padding-right: 0px; border-top-style: none; border-right-style: none; padding-top: 0px; border-image: initial">
<div><span style="font-size: 14px">&nbsp; &nbsp; &lt;property name="personDao" ref="personDao"&gt;&lt;/property&gt; &nbsp; &lt;!--反射赋值--&gt;&nbsp; &nbsp;&nbsp;</span></div></blockquote>
<blockquote style="border-bottom-style: none; padding-bottom: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; padding-right: 0px; border-top-style: none; border-right-style: none; padding-top: 0px; border-image: initial">
<div><span style="font-size: 14px">&nbsp; &nbsp; &lt;property name="name" &nbsp;value="tom test!!!!!!!!"&gt;&lt;/property&gt; &lt;!--为基本类型赋值--&gt;</span></div></blockquote><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;property name="name" &nbsp;value="100"&gt;&lt;/property&gt; &lt;!--为基本类型赋值--&gt;</span> 
<blockquote style="border-bottom-style: none; padding-bottom: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; padding-right: 0px; border-top-style: none; border-right-style: none; padding-top: 0px; border-image: initial">
<div><span style="font-size: 14px">&lt;/bean&gt;</span></div></blockquote></blockquote><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp;2.</span><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">使用内部bean 的方式注入</span><br style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<blockquote style="border-bottom-style: none; padding-bottom: 0px; widows: 2; text-transform: none; text-indent: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px 微软雅黑; white-space: normal; orphans: 2; border-top-style: none; color: rgb(0,0,0); border-right-style: none; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-image: initial">
<div><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;bean id="persionService" class="实现的类路径"&gt;<br /></span></div>
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&lt;property name="persionDao"&gt;</span></div>
<div><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;bean &nbsp;class="dao实现路径"/&gt;</span></div>
<div><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;</span></div>
<div><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/bean&gt;</span></div></blockquote><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; 3.</span><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">集合类型的注入</span> 
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &lt;bean id="personService" class="实现类路径"&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&lt;property name="sets"&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;set&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;!--此处可以为list--&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;value&gt;一个value&lt;/value&gt;<br /></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;两个value&lt;/value&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/set&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;map&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;entry key="key-1" value="value-1"/&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;entry key="</span><span style="font-size: 14px">key-2</span><span style="font-size: 14px">" value="value-2"/&gt;</span></div>
<blockquote style="border-bottom-style: none; padding-bottom: 0px; widows: 2; text-transform: none; text-indent: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px 微软雅黑; white-space: normal; orphans: 2; border-top-style: none; color: rgb(0,0,0); border-right-style: none; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-image: initial">
<blockquote style="border-bottom-style: none; padding-bottom: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; padding-right: 0px; border-top-style: none; border-right-style: none; padding-top: 0px; border-image: initial">
<blockquote style="border-bottom-style: none; padding-bottom: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; padding-right: 0px; border-top-style: none; border-right-style: none; padding-top: 0px; border-image: initial">
<div><span style="font-size: 14px">&nbsp; &lt;entry key="</span><span style="font-size: 14px">key-3</span><span style="font-size: 14px">" value="value-3"/&gt;</span></div></blockquote></blockquote></blockquote>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/map&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/property&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/bean&gt;&nbsp;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; 4.使用构造器参数注入（调用特定的构造函数）</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;如果PersonServiceBean中的有构造函数PersonServiceBean(PersonDao personDao,String name){}</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bean id="personDao11111111" class="类实现路径"&gt;&lt;bean&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;bean id="personService" class="类实现路径"&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;constructor-arg index="0" type="自定义type类的路径" ref="personDao111111"&gt;<br /></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;constructor-arg index="1" type="基本类型可以省去......" &nbsp;value="111111111"&gt;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/bean&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; 5.使用Field注入（用于注解的方式）</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; 属性的值注入</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; @Resource private PersonDao personDao; &nbsp; &nbsp; /* 先找到 容器中的 bean的对应名称进行匹配，若无，找类型匹配 */ &nbsp;&nbsp;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;属性的set方法注入</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; @Resource</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; public void setXXX(Object object){} &nbsp; &nbsp;&nbsp;</span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: 14px"><br /></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><strong><font size="3">Spring 自动扫描和管理（扫描的方式去自动管理组建）</font></strong></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">引入类配置&lt;context:component-scan base-package&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;@Service @ Resposity</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 通过class 类名首字母小写 @Service("对象名"）来获得,也可以 &nbsp;@scope("prototype")&nbsp;来设置初始化类的属性</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: medium"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;可以在方法名上面@PostConstruct 可以制定初始化方法</span></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: medium"><span style="font-size: 14px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;可以在方法名上面@PreDestory 可以在bean实例被摧毁之前执行的方法。<br /></span></span><span style="font-size: medium"><span style="font-size: 14px"><strong><br /></strong></span></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: medium"><span style="font-size: 14px"><strong>Spring和Struts2的整合</strong></span></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: medium"><span style="font-size: 14px"><strong>1.找到Struts2-Spring-plugin-.XX.jar包和Spring.jar包 加入到web项目的lib包下</strong></span></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: medium"><span style="font-size: 14px"><strong>2.配置WEB-INF/web.xml文件,加入与struts整合的监听器</strong></span></span></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-size: medium"><span style="font-size: 14px">&nbsp; &nbsp;&nbsp;</span></span>&nbsp;&lt;!--&nbsp;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp;<span class="Apple-converted-space">&nbsp;</span><span style="white-space: pre" class="Apple-tab-span"> </span>&lt;context-param&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;param-value&gt;classpath:beans.xml&lt;/param-value&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="white-space: pre" class="Apple-tab-span"></span>&lt;/context-param&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp;--&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- 若applicationContext.xml文件不在WEB-INF 下则需要将将路径放入上面参数中--&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="white-space: pre" class="Apple-tab-span"></span>&lt;listener&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="white-space: pre" class="Apple-tab-span"></span>&lt;/listener&gt;</div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></div>
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">
<div><strong>3.在struts.xml文件中加入spring常量(structs中对象的创建叫给spring)</strong></div>
<div>&nbsp; &nbsp; &nbsp;&lt;constant name="struts.objectFactory" value="spring"/&gt;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&lt;action class="loginAction" name="loginAction_*" &nbsp;method="{1}"&gt;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="white-space: pre" class="Apple-tab-span"> </span>&lt;result name="success" type="redirect"&gt;index.jsp&lt;/result&gt;&nbsp;</div>
<div>&nbsp; &nbsp;&lt;/action&gt;</div>
<div><br /></div></div>
<div><strong>4.创建applicationContext.xml文件，文件可以放在web-inf目录下，这样可以不用在1中加入context的配置</strong></div></div>
<blockquote style="border-bottom-style: none; padding-bottom: 0px; widows: 2; text-transform: none; text-indent: 0px; margin: 0px 0px 0px 40px; border-left-style: none; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px 微软雅黑; white-space: normal; orphans: 2; border-top-style: none; color: rgb(0,0,0); border-right-style: none; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; border-image: initial">
<div>
<div>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</div></div>
<div>
<div>&lt;beans xmlns="http://www.springframework.org/schema/beans"</div></div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</div></div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;xsi:schemaLocation="http://www.springframework.org/schema/beans</div></div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div></div>
<div>
<div>&nbsp; &nbsp; &lt;bean id="loginAction" class="xxxxxxxxxxxxxxxxxxxxxxx" scope="prototype"/&gt;</div></div>
<div>
<div>&lt;/beans&gt;</div></div></blockquote><span style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px 微软雅黑; white-space: normal; orphans: 2; float: none; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">注意：(1)struts2中需要加入prototype（原型）的配置，这样才能满足struts2为每次请求创建一个对象的服务方式 &nbsp;</span> 
<div style="widows: 2; text-transform: none; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (2)此处的id 名需要与3中的class同名</div><img src ="http://www.blogjava.net/Tomshi-Xu/aggbug/390767.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Tomshi-Xu/" target="_blank">Tom Xu</a> 2012-11-04 22:43 <a href="http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390767.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>可重复性读写锁 显式锁 隐式锁 线程进程同步读写同步（ReentrantReadWriteLock  Lock Synchronized )</title><link>http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390766.html</link><dc:creator>Tom Xu</dc:creator><author>Tom Xu</author><pubDate>Sun, 04 Nov 2012 14:37:00 GMT</pubDate><guid>http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390766.html</guid><wfw:comment>http://www.blogjava.net/Tomshi-Xu/comments/390766.html</wfw:comment><comments>http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390766.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Tomshi-Xu/comments/commentRss/390766.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Tomshi-Xu/services/trackbacks/390766.html</trackback:ping><description><![CDATA[<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0"><strong>ReentrantReadWriteLock的特性</strong></p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">1.公平性和非公平性获取锁：</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">&nbsp;&nbsp;&nbsp;&nbsp;支持按照公平的原则获取锁，即读写线程按照最长等待时间分配锁</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">&nbsp;&nbsp;&nbsp;&nbsp;若构造为非公平性的，则按照先到先得的顺序，但是有读线程想获取锁时，该顺序被打破</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">2.重复获得锁：读线程可以重复的获取锁，尽管当前读线程占用</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">3.锁降级：</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">&nbsp; &nbsp; 可以将write lock 的等级降为 read lock ,顺序是：先获得WriteLock再获得ReadLock，然后释放WriteLock，这时候线程将保持Readlock的持 有。</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">&nbsp; &nbsp;反过来ReadLock想要升级为WriteLock则不可能</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">4.中断锁的获取：读锁和写锁的获取期间都允许被中断</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">5.Condition 类的支持：该支持仅仅就写操作而言，若readLock(0.newCondition() 将会throws UnsupprotedoperationException</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">6.可监测性：这个类支持操作是否对锁的获取还是竞争，只是为检测系统状态，而不是为了同步而设计的。</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0"><br /></p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0"><strong>显式锁（Lock）和隐式锁(Synchronized)的不同点，括号注明隐式锁与重复读写锁（ReentrantReadWriteLock）的区别</strong></p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">1.不能主动中断正在试图获得锁的线程 &nbsp;（显式写操作锁可以主动的挂起读操作锁，进行写操作）</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">2.试图获得锁时不能设置超时</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">3.在对象内部锁只有一个并且内部锁只有一个单一的条件，可能不够用(显示锁可以有多个，不断重复的对读写操作加锁)</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0"><br /></p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0"><strong>对ReentrantReadWriteLock类测试</strong></p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">&nbsp; &nbsp;1.读/写操作的锁多线程测试 : 单独的读操作和写操作何以完成读或写的同步</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">&nbsp; &nbsp;2.读操作所和写操作锁多线程测试 : &nbsp;能同步 (必需操作类中将 ReentrantReadWriteLock声明为static的成员变量)</p>
<p style="widows: 2; text-transform: none; margin-top: 0pt; text-indent: 0px; letter-spacing: normal; font: 14px 微软雅黑; white-space: normal; orphans: 2; margin-bottom: 0pt; color: #000000; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p0">&nbsp; &nbsp;3.读操作进程和写操作进程间测试：不支持进程间的同步</p><img src ="http://www.blogjava.net/Tomshi-Xu/aggbug/390766.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Tomshi-Xu/" target="_blank">Tom Xu</a> 2012-11-04 22:37 <a href="http://www.blogjava.net/Tomshi-Xu/archive/2012/11/04/390766.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>线程和进程 对文件锁的操作(RandomAccessFile MappedByteBuffer FileLock)</title><link>http://www.blogjava.net/Tomshi-Xu/archive/2012/10/26/390291.html</link><dc:creator>Tom Xu</dc:creator><author>Tom Xu</author><pubDate>Fri, 26 Oct 2012 10:34:00 GMT</pubDate><guid>http://www.blogjava.net/Tomshi-Xu/archive/2012/10/26/390291.html</guid><wfw:comment>http://www.blogjava.net/Tomshi-Xu/comments/390291.html</wfw:comment><comments>http://www.blogjava.net/Tomshi-Xu/archive/2012/10/26/390291.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/Tomshi-Xu/comments/commentRss/390291.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Tomshi-Xu/services/trackbacks/390291.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 文件锁 线程和进程操作文件锁 文件映射 同步&nbsp;&nbsp;<a href='http://www.blogjava.net/Tomshi-Xu/archive/2012/10/26/390291.html'>阅读全文</a><img src ="http://www.blogjava.net/Tomshi-Xu/aggbug/390291.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Tomshi-Xu/" target="_blank">Tom Xu</a> 2012-10-26 18:34 <a href="http://www.blogjava.net/Tomshi-Xu/archive/2012/10/26/390291.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>