`
- 浏览:
2952262 次
- 性别:
- 来自:
上海
-
spring transaction and interceptor
spring 声明性事务
java 代码
- "category" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true">
- "transactionManager">"hibernatetransaction"/>
- "target">"categoryhelper"/>
- "transactionAttributes">
-
<props></props>
- "get*">PROPAGATION_REQUIRED,readOnly
- "find*">PROPAGATION_REQUIRED,readOnly
- "save*">PROPAGATION_REQUIRED
- "del*">PROPAGATION_REQUIRED
-
-
-
spring interceptor
java 代码
- public boolean beforeAction(Action action, ActionMapping mapping,
- ActionForm form, HttpServletRequest request,
- HttpServletResponse response)
- {
- if (logger.isDebugEnabled())
- {
- logger.debug("edit vote permission interceptor beforeAction called");
- }
-
- int voteID = ParamUtils.getInteger(request , "voteid");
-
- try
- {
-
- Vote vote = ForumNukeServiceLocatorFactory.getServiceLocator().getVoteHelper().getVote(voteID);
- HttpSession session = request.getSession();
- OnlineUser sessionUser = (OnlineUser)session.getAttribute(Constants.SESSION_ONLINEUSER_KEY);
- if (sessionUser.getUserName().equals(vote.getPoster()))
- {
- Forum forum = (Forum)ForumNukeServiceLocatorFactory.getServiceLocator().getThreadHelper().getThreadByVote(voteID).getForum();
-
-
- Permission perm = UserFactory.newPermission("editvote.do" , true , "forumid=" + forum.getForumID());
- return hasPermission(perm , request , response , mapping);
- }
- else
- {
- forwardNoPermission(mapping , request , response);
- }
- }
- catch(Exception e)
- {
- e.printStackTrace();
- forwardNoPermission(mapping , request , response);
- }
-
- return false;
- }
-
-
-
-
-
-
-
-
-
-
- public boolean afterAction(Action action, ActionMapping mapping,
- ActionForm form, HttpServletRequest request,
- HttpServletResponse response)
- {
- if (logger.isDebugEnabled())
- {
- logger.debug("edit vote permission interceptor afterAction called");
- }
-
- return true;
- }
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0': Error setting property values; nested ...
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <!-- 事务拦截器bean需要依赖注入一个事务管理器 --> <!-- 下面定义事务传播属性 --> *...
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="target"><ref bean=...
2. **配置事务处理**:修改`jbpm.tx.spring.cfg.xml`文件,将`standard-transaction-interceptor`改为`spring-transaction-interceptor`,并将`transaction`和`hibernate-session`设置为`current="true"`。...
<object id="transactionManager" type="Spring.Transaction.Interceptor.TxScopeTransactionManager, Spring.Transaction"> ``` 4. **定义事务属性** 你可以使用 AOP 的特性(如 `TransactionAttribute`)...
`org.springframework.transaction`和`org.springframework.transaction.interceptor`包中的TransactionInterceptor处理事务的开始、提交和回滚。 五、其他关键模块 9. **Spring表达式语言(SpEL)**:在`org....
<bean id="userDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <!-- 配置事务管理器 --> <!-- 配置需要代理的方法 --> <!-- 配置事务属性 --> *">...
<bean id="myService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> *">PROPAGATION_REQUIRED, -Exception ``` 这里,`myServiceImpl`是实际的业务类,`...
`org.springframework.transaction.interceptor`包下的`TransactionInterceptor`是声明式事务管理的核心,它结合`@Transactional`注解实现事务的自动管理。 通过阅读和理解这些源码注解,开发者可以更好地掌握...
<bean id="userManager"class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref bean="transactionManager"/></property> ...
在源代码中,`org.springframework.transaction.interceptor`包下的类实现了事务的切面处理。 总的来说,深入分析Spring框架的源代码,能够帮助我们理解其设计思想和实现原理,从而在实际开发中更好地利用这些功能...
<bean id="userDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <!-- 配置事务管理器 --> <!-- 配置事务属性 --> *">PROPAGATION_REQUIRED,readOnly *">...
3. Spring事务管理(Spring Transaction Management): Spring提供了强大的事务管理功能,无论是编程式还是声明式的事务管理,都能帮助开发者有效地控制事务的边界。声明式事务管理通过@Transactional注解实现,...
<bean id="userDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> ``` 在上面的配置中,我们定义了一个SessionFactory、一个TransactionManager和一个DAO对象。然后,...
<bean id="userDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="proxyInterfaces" value="com.bluesky.spring.dao.GeneratorDao"/> REQUIRED ...
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> *">PROPAGATION_REQUIRED *">PROPAGATION_REQUIRED *">PROPAGATION_REQUIRED *">...
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <!--配置事务管理器--> <property name="proxyInterfaces" value="com.bluesky.spring.dao.GeneratorDao"/> <!--配置...
<bean id="userDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <!-- 配置事务规则 --> *">PROPAGATION_REQUIRED,readOnly *">PROPAGATION_REQUIRED *">...