Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6861695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:34:05+00:00 2026-05-27T02:34:05+00:00

I need to use a Custom AnnotationTransactionAttributeSource in order to intercept transaction attributes. Right

  • 0

I need to use a Custom AnnotationTransactionAttributeSource in order to intercept transaction attributes. Right now, I do this using the TransactionInterceptor and injecting this in TransactionAttributeSourceAdvisor .The proxies are created using DefaultAdvisorAutoProxyCreator as given below.

<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>

<bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
    <property name="transactionInterceptor" ref="txInterceptor"/>
</bean>

<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
    <property name="transactionManager" ref="txManager"/>
    <property name="transactionAttributeSource"> 
       <bean class="org.myProject.transaction.CustomAnnotationTransactionAttributeSource"/>
    </property>
</bean>

Here, CustomAnnotationTransactionAttributeSource extends AnnotationTransactionAttributeSource. Is there any way I can force Tx:annotation-driven to use my CustomAnnotationTransactionAttributeSource so that I could avoid all these configurations? . I read in one of the posts that this could be done by using BeanPostProcessors but not sure how to use it for this case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:34:05+00:00Added an answer on May 27, 2026 at 2:34 am

    <tx:annotation-driven> doesn’t do anything magic, it just registers almost the same bean definitions as you do manually (see AnnotationDrivenBeanDefinitionParser).

    So, you can either replace references to AnnotationTransactionAttributeSource from other beans, or replace class name property in its definition. The latter looks simplier (though more fragile with respect to changes in Spring code) and can be done by the following BeanFactoryPostProcessor:

    public class AnnotationTransactionAttributeSourceReplacer implements BeanFactoryPostProcessor {
        public void postProcessBeanFactory(ConfigurableListableBeanFactory factory)
                throws BeansException {
    
            String[] names = factory.getBeanNamesForType(AnnotationTransactionAttributeSource.class);
    
            for (String name: names) {
                BeanDefinition bd = factory.getBeanDefinition(name);
                bd.setBeanClassName("org.myProject.transaction.CustomAnnotationTransactionAttributeSource");
            }            
        }       
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi am using webview ,i need to use custom font(verdana.ttf) how can i do
I need the ability to use custom locks at a session level (outside the
I need to use a custom NSView subclass to draw some content, but it
I need to use custom cell renderer for my JTree to add some JLabel
I'm creating a WPF application where I need to use custom fonts. A created
Is there a way I could use custom membership provider without need to create
If you want to use custom sockets for RMI (e.g. using SSL), in UnicastRemoteObject.exportObject(4)
I have downloaded the silver light from this http://www.microsoft.com/silverlight// I need to use this
In my WCF project I need to use custom headers in responses so I
I have some things I need to use custom SQL for. Just to start,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.