[Java] spring3 注解事务 回滚失败 →→→→→进入此内容的聊天室

来自 , 2021-01-11, 写在 Java, 查看 153 次.
URL http://www.code666.cn/view/5680522b
  1.  <!--
  2.  
  3. Code highlighting produced by Actipro CodeHighlighter (freeware)
  4. http://www.CodeHighlighter.com/
  5.  
  6. -->
  7. <?xml version="1.0" encoding="UTF-8"?>
  8. <beans xmlns="http://www.springframework.org/schema/beans"
  9.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  10.     xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop"
  11.     xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
  12.     xsi:schemaLocation="
  13.    http://www.springframework.org/schema/beans
  14.    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  15.    http://www.springframework.org/schema/context
  16.    http://www.springframework.org/schema/context/spring-context-3.0.xsd
  17.    http://www.springframework.org/schema/jee
  18.    http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
  19.    http://www.springframework.org/schema/tx
  20.    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  21.    http://www.springframework.org/schema/aop
  22.    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  23.    http://www.springframework.org/schema/mvc
  24.    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
  25.  
  26.     <context:annotation-config />
  27.     <bean id="dataSource"
  28.         class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  29.         <property name="url">
  30.             <value>jdbc:mysql://localhost:3306/hterp_2011?useUnicode=true&characterEncoding=UTF-8
  31.             </value>
  32.         </property>
  33.         <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
  34.         <property name="username" value="root"></property>
  35.         <property name="password" value="root"></property>
  36.     </bean>
  37.  
  38.     <bean id="sessionFactory"
  39.         class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
  40.         <property name="dataSource" ref="dataSource" />
  41.  
  42.         <property name="packagesToScan" value="com.blooming.impl" />
  43.  
  44.         <property name="hibernateProperties">
  45.             <props>
  46.                 <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
  47.                 <prop key="hibernate.show_sql">true</prop>
  48.                 <prop key="hibernate.format_sql">true</prop>
  49.                 <!--
  50.                 <prop key="hibernate.hbm2ddl.auto">update</prop>
  51.                  -->
  52.             </props>
  53.         </property>
  54.     </bean>
  55.  
  56.  
  57.     <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  58.         <property name="dataSource" ref="dataSource" />
  59.     </bean>
  60.     <bean id="transactionManager"
  61.         class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  62.        
  63.         <property name="sessionFactory" ref="sessionFactory" />
  64.     </bean>
  65.     <bean id="messageSource"
  66.         class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
  67.         <property name="basename" value="messages/messages" />
  68.         <property name="cacheSeconds" value="0" />
  69.     </bean>
  70.     <context:component-scan base-package="com.blooming.impl.*" />
  71.     <context:component-scan base-package="org.springframework.samples.mvc.basic.account"></context:component-scan>
  72.    
  73.     <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
  74.  
  75.     <mvc:annotation-driven />
  76.     <mvc:interceptors>
  77.         <bean class="com.blooming.web.handler.UserInterceptorAdapter" />
  78.     </mvc:interceptors>
  79.     <bean
  80.         class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
  81.         <property name="mediaTypes">
  82.             <map>
  83.                 <entry key="html" value="text/html" />
  84.                 <entry key="json" value="application/json" />
  85.             </map>
  86.         </property>
  87.     </bean>
  88.     <bean id="multipartResolver"
  89.         class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  90.         <property name="maxUploadSize" value="1000000" />
  91.     </bean>
  92.     <bean
  93.         class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  94.         <property name="prefix" value="/WEB-INF/classes/views/" />
  95.         <property name="suffix" value=".jsp" />
  96.     </bean>
  97.    
  98.    
  99.    
  100.     <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor"/>
  101. </beans>
  102.  
  103.  
  104.  
  105.  //源代码片段来自云代码http://yuncode.net
  106.                        

回复 "spring3 注解事务 回滚失败"

这儿你可以回复上面这条便签

captcha