﻿<?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-VIRGIN FOREST OF JAVA-文章分类-SPRING</title><link>http://www.blogjava.net/RR00/category/2954.html</link><description>不要埋头苦干，要学习，学习，再学习。。。。。
&lt;br&gt;
powered  by &lt;font color='orange'&gt;R.Zeus&lt;/font&gt;</description><language>zh-cn</language><lastBuildDate>Thu, 08 Mar 2007 02:41:10 GMT</lastBuildDate><pubDate>Thu, 08 Mar 2007 02:41:10 GMT</pubDate><ttl>60</ttl><item><title>acegi in spring</title><link>http://www.blogjava.net/RR00/articles/102379.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Wed, 07 Mar 2007 05:24:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/102379.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/102379.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/102379.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/102379.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/102379.html</trackback:ping><description><![CDATA[when read the acgi.xml and according source code,I found the way spring read the value ,on the other hand,how spring choose the editor to resolve the value.<br />for example,the "filterInvocationDefinitionSource" properties,Spring will choose the class "FilterInvocationDefinitionSourceEditor" to solve  the "filterInvocationDefinitionSource".u may notes that <br />the "FilterInvocationDefinitionSourceEditor" = "filterInvocationDefinitionSource" plus "editor" ignore the case.<br />That is exactly what Spring do.<br /><br />in acegi , "filterInvocationDefinitionSource"  use to store urls for filering,so when u understand the its struture ,u can <br />get the url for database,not explicitly.<br /><br />for the key word " CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON",it means u must <br />set the properties name lower case,otherwise will be error.<br /><br />and "  PATTERN_TYPE_APACHE_ANT" means use class PathBasedFilterInvocationDefinitionMap,default use<br />class RegExpBasedFilterInvocationDefinitionMap.<img src ="http://www.blogjava.net/RR00/aggbug/102379.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2007-03-07 13:24 <a href="http://www.blogjava.net/RR00/articles/102379.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CronExpression </title><link>http://www.blogjava.net/RR00/articles/83242.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Fri, 24 Nov 2006 06:17:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/83242.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/83242.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/83242.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/83242.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/83242.html</trackback:ping><description><![CDATA[
		<dl>
				<dt>public class <b>CronExpression</b></dt>
				<dt>extends <a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</a></dt>
				<dt>implements <a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html">Serializable</a>, <a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Cloneable.html">Cloneable</a></dt>
		</dl>
		<p>Provides a parser and evaluator for unix-like cron expressions. Cron expressions provide the ability to specify complex time combinations such as "At 8:00am every Monday through Friday" or "At 1:30am every last Friday of the month". </p>
		<p>Cron expressions are comprised of 6 required fields and one optional field separated by white space. The fields respectively are described as follows: </p>
		<table cellspacing="8">
				<tbody>
						<tr>
								<th align="left">Field Name</th>
								<th align="left"> </th>
								<th align="left">Allowed Values</th>
								<th align="left"> </th>
								<th align="left">Allowed Special Characters</th>
						</tr>
						<tr>
								<td align="left">
										<code>Seconds</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>0-59</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>, - * /</code>
								</td>
						</tr>
						<tr>
								<td align="left">
										<code>Minutes</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>0-59</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>, - * /</code>
								</td>
						</tr>
						<tr>
								<td align="left">
										<code>Hours</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>0-23</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>, - * /</code>
								</td>
						</tr>
						<tr>
								<td align="left">
										<code>Day-of-month</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>1-31</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>, - * ? / L W</code>
								</td>
						</tr>
						<tr>
								<td align="left">
										<code>Month</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>1-12 or JAN-DEC</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>, - * /</code>
								</td>
						</tr>
						<tr>
								<td align="left">
										<code>Day-of-Week</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>1-7 or SUN-SAT</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>, - * ? / L #</code>
								</td>
						</tr>
						<tr>
								<td align="left">
										<code>Year (Optional)</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>empty, 1970-2099</code>
								</td>
								<td align="left"> </td>
								<td align="left">
										<code>, - * /</code>
								</td>
						</tr>
				</tbody>
		</table>
		<p>The '*' character is used to specify all values. For example, "*" in the minute field means "every minute". </p>
		<p>The '?' character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fileds, but not the other. </p>
		<p>The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12". </p>
		<p>The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday". </p>
		<p>The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the seconds field means "the seconds 5, 20, 35, and 50". Specifying '*' before the '/' is equivalent to specifying 0 is the value to start with. Essentially, for each field in the expression, there is a set of numbers that can be turned on or off. For seconds and minutes, the numbers range from 0 to 59. For hours 0 to 23, for days of the month 0 to 31, and for months 1 to 12. The "/" character simply helps you turn on every "nth" value in the given set. Thus "7/6" in the month field only turns on month "7", it does NOT mean every 6th month, please note that subtlety. </p>
		<p>The 'L' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "last", but it has different meaning in each of the two fields. For example, the value "L" in the day-of-month field means "the last day of the month" - day 31 for January, day 28 for February on non-leap years. If used in the day-of-week field by itself, it simply means "7" or "SAT". But if used in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last friday of the month". When using the 'L' option, it is important not to specify lists, or ranges of values, as you'll get confusing results. </p>
		<p>The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the trigger will fire on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not 'jump' over the boundary of a month's days. The 'W' character can only be specified when the day-of-month is a single day, not a range or list of days. </p>
		<p>The 'L' and 'W' characters can also be combined for the day-of-month expression to yield 'LW', which translates to "last weekday of the month". </p>
		<p>The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month. For example, the value of "6#3" in the day-of-week field means the third Friday of the month (day 6 = Friday and "#3" = the 3rd one in the month). Other examples: "2#1" = the first Monday of the month and "4#5" = the fifth Wednesday of the month. Note that if you specify "#5" and there is not 5 of the given day-of-week in the month, then no firing will occur that month. </p>
		<p>
				<!--The 'C' character is allowed for the day-of-month and day-of-week fields.
 This character is short-hand for "calendar". This means values are
 calculated against the associated calendar, if any. If no calendar is
 associated, then it is equivalent to having an all-inclusive calendar. A
 value of "5C" in the day-of-month field means "the first day included by the
 calendar on or after the 5th". A value of "1C" in the day-of-week field
 means "the first day included by the calendar on or after sunday".-->
		</p>
		<p>The legal characters and the names of months and days of the week are not case sensitive. </p>
		<p>
				<b>NOTES:</b>
		</p>
		<ul>
				<li>Support for specifying both a day-of-week and a day-of-month value is not complete (you'll need to use the '?' character in on of these fields). </li>
		</ul>
		<p>
		</p>
		<p>
		</p>
		<p>
		</p>
		<dl>
				<dt>
						<b>Author:</b>
				</dt>
				<dd>Sharada Jambula, James House, Contributions from Mads Henderson, Refactoring from CronTrigger to CronExpression by Aaron Craven <br /><br /><br /><font color="#a52a2a"><strong>ATTENTION::</strong><br /></font><font style="BACKGROUND-COLOR: #ff1493" color="#ff1493"><font style="BACKGROUND-COLOR: #ffffff" color="#0000ff">it seems the default time  between successive task executions is <font color="#ff1493">1 second</font>,so you must set the second otherwise the trigger will be activated continually.<br /><br />The batchjob can do only when the application is alive.if it's close,the job will <br />shutdown.for example,in testcase,the batch job will only do once.<br /></font><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></font></dd>
		</dl>
<img src ="http://www.blogjava.net/RR00/aggbug/83242.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2006-11-24 14:17 <a href="http://www.blogjava.net/RR00/articles/83242.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>i18n-fuck the ReloadableResourceBundleMessageSource</title><link>http://www.blogjava.net/RR00/articles/76821.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Mon, 23 Oct 2006 12:11:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/76821.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/76821.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/76821.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/76821.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/76821.html</trackback:ping><description><![CDATA[
		<font style="BACKGROUND-COLOR: #ffffff" color="#0000ff"> &lt;bean id="messageSource"<br />          class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;<br />        &lt;property name="basename"&gt;<br />            &lt;value&gt;com/suzsoft/jportal/usermanagement/acegi/ApplicationMessages_zh_CN&lt;/value&gt;<br />        &lt;/property&gt;<br />        &lt;property name="alwaysUseMessageFormat" value="true"/&gt;<br />    &lt;/bean&gt;<br /><br /><br /><font color="#000000">this from the reference,but the ReloadableResourceBundleMessageSource seems never init and i don't konw how to make it work.<br /><br />at the last ,I use</font><br /><br />  &lt;bean id="messageSource"<br />          class="org.springframework.context.support.ResourceBundleMessageSource"&gt;<br />        &lt;property name="basename"&gt;<br />            &lt;value&gt;com.suzsoft.jportal.usermanagement.acegi.ApplicationMessages&lt;/value&gt;<br />        &lt;/property&gt;<br />        &lt;property name="alwaysUseMessageFormat" value="true"/&gt;<br /> &lt;/bean&gt;<br /><br /><font color="#ee82ee">ResourceBundleMessageSource:</font><br /><h3>setBasename</h3><pre>public void <b>setBasename</b>(<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html">String</a> basename)</pre><p>Set a single basename, following ResourceBundle conventions: It is a fully-qualified classname. If it doesn't contain a package qualifier (such as org.mypackage), it will be resolved from the classpath root. </p><p>Messages will normally be held in the /lib or /classes directory of a WAR. They can also be held in Jars on the class path. For example, a Jar in an application's manifest classpath could contain messages for the application. <br /><br /><font color="#ffc0cb">ReloadableResourceBundleMessageSource:</font><br /><br /></p><h3>setBasename</h3><pre>public void <b>setBasename</b>(<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html"><font color="#002c99">String</font></a> basename)</pre><dl><dd>Set a single basename, following the basic ResourceBundle convention of not specifying file extension or language codes, but in contrast to ResourceBundleMessageSource referring to a Spring resource location: e.g. "WEB-INF/messages" for "WEB-INF/messages.properties", "WEB-INF/messages_en.properties", etc. 
<p>As of Spring 1.2.2, XML properties files are also supported: e.g. "WEB-INF/messages" will find and load "WEB-INF/messages.xml", "WEB-INF/messages_en.xml", etc as well. Note that this will only work on JDK 1.5+. </p><p></p><br /></dd></dl></font>
<img src ="http://www.blogjava.net/RR00/aggbug/76821.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2006-10-23 20:11 <a href="http://www.blogjava.net/RR00/articles/76821.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>more server run applicatin on the same database will be error!</title><link>http://www.blogjava.net/RR00/articles/76370.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Fri, 20 Oct 2006 05:35:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/76370.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/76370.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/76370.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/76370.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/76370.html</trackback:ping><description><![CDATA[
		<p align="left">                      <font color="#000000" size="5">if there are more than two server run with the same system code<br />            and call the <font color="#ff1493">save</font> method at the same time ,it will be result of hibernate<br />            error!because hibernate get the max id for ganerator and store it in<br />            cache for next time using.so one server will get the expired id if another<br />            server change the database following.<br />            befroe save object,hibernate will excute this sql after the server start up <font color="#ff1493">once</font>:<br />             Hibernate: select max(ID) from TB_LOG<br />            TB_LOG is my log table.</font></p>
<img src ="http://www.blogjava.net/RR00/aggbug/76370.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2006-10-20 13:35 <a href="http://www.blogjava.net/RR00/articles/76370.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java.sql.SQLException: Connection is broken</title><link>http://www.blogjava.net/RR00/articles/63243.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Sat, 12 Aug 2006 12:11:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/63243.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/63243.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/63243.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/63243.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/63243.html</trackback:ping><description><![CDATA[
		<p>
				<font style="BACKGROUND-COLOR: #ffc0cb">WARN - SettingsFactory.buildSettings(103) | Could not obtain connection metadata</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ffc0cb">java.sql.SQLException: Connection is broken<br />        at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)<br />        at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)<br />        at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)<br />        at org.hsqldb.jdbc.jdbcDatabaseMetaData.execute(Unknown Source)<br />        at org.hsqldb.jdbc.jdbcDatabaseMetaData.getDatabaseProductName(Unknown S<br />ource)<br />        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:<br />75)<br />        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881<br />)<br />        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav<br />a:1174)<br />        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession<br />Factory(LocalSessionFactoryBean.java:825)<br /><br /><br /></font>
				<font style="BACKGROUND-COLOR: #ffff00">因为我在lib中放了hsqldb-1.7.3.0.jar所以导致了错误！<br /></font>
		</p>
<img src ="http://www.blogjava.net/RR00/aggbug/63243.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2006-08-12 20:11 <a href="http://www.blogjava.net/RR00/articles/63243.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>tiles</title><link>http://www.blogjava.net/RR00/articles/62793.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Thu, 10 Aug 2006 06:51:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/62793.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/62793.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/62793.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/62793.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/62793.html</trackback:ping><description><![CDATA[&lt;%@ include file=".......Taglibs.jsp" %&gt;<br />虽然定义的body里有了tag，但是各自的页面还要加，因为这是动态编译以后加载,所以每个页面都应该有！<img src ="http://www.blogjava.net/RR00/aggbug/62793.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2006-08-10 14:51 <a href="http://www.blogjava.net/RR00/articles/62793.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mock </title><link>http://www.blogjava.net/RR00/articles/61822.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Fri, 04 Aug 2006 10:56:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/61822.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/61822.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/61822.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/61822.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/61822.html</trackback:ping><description><![CDATA[mock是个模拟测试的东西，她创造的东西都是假的，在数据库测试，网络测试中可以 用的很爽！<br /><br />public class MockPrototypeTestCase extends org.jmock.MockObjectTestCase {<br />    Mock accountService = null;<br /><br />    MockPrototype mo = new MockPrototype();<br />    protected void setUp() throws Exception {<br />        super.setUp();<br />        accountService = new Mock(AccountService.class);<br /><font style="BACKGROUND-COLOR: #ffc0cb" color="#0000ff">//在MockPrototype 要用到AccountService.class，所以这里创建了一个，不过这个不是真实的，是模拟的<br /></font>        mo.setAccountService((AccountService) accountService.proxy());<br />    }<br />    protected void tearDown() throws Exception {<br />        super.tearDown();<br />        mo = null;<br />    }<br />    public void testloginProcess() {<br />        Account a = new Account();<br />        a.setLoginId("aa");<br />        a.setPassword(StringUtil.encodePassword("bb", Constants.PASSWORD_ENCODING_TYPE));<br /><font style="BACKGROUND-COLOR: #ffc0cb" color="#0000ff">//这里模拟了      getAccount，即getAccount("aa"),返回a；在mock中没有真实的东西，都是模拟的！</font><br />  accountService.expects(atLeastOnce()) <font style="BACKGROUND-COLOR: #ffc0cb" color="#0000ff">//注意 atLeastOnce()这个参数，这个指定使用次数，如果是<br /></font>                .method("getAccount")           <font style="BACKGROUND-COLOR: #ffc0cb" color="#000080"> <strong> //atLeastOnce,则这个method中则至少使用一次，否则会报错！</strong></font><br />                .with(eq("aa"))                     <font style="BACKGROUND-COLOR: #ffc0cb" color="#0000ff"> //总之，按照定义的函数调用，同时必须遵守规定，如次数！</font><br />                .will(returnValue(a));            <font style="BACKGROUND-COLOR: #ffc0cb" color="#0000ff">//在mo的loginProcess()中，会用到这些方法<br /></font>        accountService.expects(atLeastOnce())<br />                .method("getAccount")<br />                .with(eq("cc"))<br />                .will(returnValue(null));<br />        mo.loginProcess("aa","bb");<br />        try {<br />            mo.loginProcess("cc","bb");<br />        } catch (FrameworkdemoServiceException e) {<br />            assertEquals(e.getMessage(),"null.lll");  //To change body of catch statement use File | Settings | File Templates.<br />        }<br />    }<br />}<img src ="http://www.blogjava.net/RR00/aggbug/61822.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2006-08-04 18:56 <a href="http://www.blogjava.net/RR00/articles/61822.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>spring service manager</title><link>http://www.blogjava.net/RR00/articles/61692.html</link><dc:creator>R.Zeus</dc:creator><author>R.Zeus</author><pubDate>Fri, 04 Aug 2006 03:36:00 GMT</pubDate><guid>http://www.blogjava.net/RR00/articles/61692.html</guid><wfw:comment>http://www.blogjava.net/RR00/comments/61692.html</wfw:comment><comments>http://www.blogjava.net/RR00/articles/61692.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/RR00/comments/commentRss/61692.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/RR00/services/trackbacks/61692.html</trackback:ping><description><![CDATA[　&lt;props&gt;<br />                &lt;prop key="process*"&gt;PROPAGATION_REQUIRED, +FrameworkdemoServiceException&lt;/prop&gt;<br />                &lt;prop key="*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt;<br />            &lt;/props&gt;<br /><br />我们还指定，当方法抛出FrameworkdemoServiceException类型的异常时，addLineItem就总是回滚事务。这就达到了另一个粒度级别：在异常场景中，我们的控制可以精细到TX的具体结束方式。前缀符号“-”指定回滚TX，而前缀符号“+”指定提交TX<strong><font style="BACKGROUND-COLOR: #ffc0cb">。("-"时，回滚，“+”，不回滚）<br /><br /><br />事务是否会滚要看每个method的配置！<br />如果一个事务为+，则它的失败对别的service没有影响！<br />如果为-，则它的失败对别人有影响！<br />还要看整个method的属性~！<br /><br /><br />&lt;bean id="propanagationTestAccountService" parent="transactionProxyTemplate"&gt;<br />        &lt;property name="target"&gt;<br />            &lt;bean class="com.suzsoft.demo.account.service.PropagationTestAccountServiceImpl" autowire="byName"/&gt;<br />        &lt;/property&gt;<br />        &lt;property name="transactionAttributes"&gt;<br />            &lt;props&gt;<br />                &lt;prop key="new*"&gt;PROPAGATION_REQUIRED,+FrameworkdemoServiceException&lt;/prop&gt;<br />                &lt;prop key="edit*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;<br />           <br /><br /><br /> &lt;bean id="loginService" parent="transactionProxyTemplate"&gt;<br />        &lt;property name="target"&gt;<br />            &lt;bean class="com.suzsoft.demo.account.service.LoginServiceImpl" autowire="byName"/&gt;<br />        &lt;/property&gt;<br />        &lt;property name="transactionAttributes"&gt;<br />            &lt;props&gt;<br />                &lt;prop key="login*"&gt;PROPAGATION_REQUIRED,+FrameworkdemoServiceException&lt;/prop&gt;<br />                &lt;prop key="*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt;<br />            &lt;/props&gt;<br />        &lt;/pr<br /><br /><br />方法中的事务才不回滚<br /></font></strong><br /><br />key属性确定代理应该给哪个方法增加事务行为。这样的属性最重要的部份是传播行为。有以下选项可供使用：<br />PROPAGATION_REQUIRED--支持当前事务，如果当前没有事务，就新建一个事务。这是最常见的选择。 <br />PROPAGATION_SUPPORTS--支持当前事务，如果当前没有事务，就以非事务方式执行。 <br />PROPAGATION_MANDATORY--支持当前事务，如果当前没有事务，就抛出异常。 <br />PROPAGATION_REQUIRES_NEW--新建事务，如果当前存在事务，把当前事务挂起。 <br />PROPAGATION_NOT_SUPPORTED--以非事务方式执行操作，如果当前存在事务，就把当前事务挂起。 <br />PROPAGATION_NEVER--以非事务方式执行，如果当前存在事务，则抛出异常。 <br />PROPAGATION_NESTED--如果当前存在事务，则在嵌套事务内执行。如果当前没有事务，则进行与PROPAGATION_REQUIRED类似的操作。 <br /><br />回滚事务中，spring 似乎把bean存到缓存中，等到事务全部处理完，没有会滚，才把bean存入数据库，如果这期间bean有变化，存入的是变化后的bean ，如<br /><br /> Account account1 = new Account();<br />        account1.setLoginId("prowww1");<br /> propanagationTestAccountService.newAccount(account1);<br /> account1.setLoginId("acodddddddddw1");<br />最后存入数据库的bean longId 是后面的数据：("acodddddddddw1");<br /><img src ="http://www.blogjava.net/RR00/aggbug/61692.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/RR00/" target="_blank">R.Zeus</a> 2006-08-04 11:36 <a href="http://www.blogjava.net/RR00/articles/61692.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>