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

  • SEARCH
  • Home
  • 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 843363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:06:52+00:00 2026-05-15T06:06:52+00:00

We have: @Transactional(propagation = Propagation.REQUIRED) public class MyClass implementes MyInterface { … MyInterface has

  • 0

We have:

@Transactional(propagation = Propagation.REQUIRED)
public class MyClass implementes MyInterface { ...

MyInterface has a single method: go().

When go() executes we start a new transaction which commits/rollbacks when the method is complete – this is fine.

Now let’s say in go() we call a private method in MyClass that has @Transactional(propagation = Propagation.REQUIRES_NEW. It seems that Spring “ignores” the REQUIRES_NEW annotation and does not start a new transaction. I believe this is because Spring AOP operates on the interface level (MyInterface) and does not intercept any calls to MyClass methods. Is this correct?

Is there any way to start a new transaction within the go() transaction? Is the only way to call another Spring managed bean that has transactions configured as REQUIRES_NEW?


Update: Adding that when clients execute go() they do so via a reference to the interface, not the class:

@Autowired
MyInterface impl;

impl.go();
  • 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-15T06:06:53+00:00Added an answer on May 15, 2026 at 6:06 am

    From the Spring reference 2.5:

    When using proxies, the @Transactional annotation should only be applied to
    methods with public visibility. If you do annotate protected, private or
    package-visible methods with the @Transactional annotation, no error will
    be raised, but the annotated method will not exhibit the configured transactional
    settings.

    So Spring ignores @Transactional annotation on non-public methods.

    Also,

    In proxy mode (which is the default), only ‘external’ method calls coming in
    through the proxy will be intercepted. This means that ‘self-invocation’,
    i.e. a method within the target object calling some other method of the target
    object, won’t lead to an actual transaction at runtime even if the invoked
    method is marked with @Transactional!

    So even if you make your method public, calling it from within a method of same class will not start a new transaction.

    You can use aspectj mode in transaction settings so that the transaction related code is weaved in the class and no proxy is created at runtime.

    See the reference document for more details.

    Another possible way of doing this is fetching the spring proxy of the class in the class itself and call methods on it rather than this:

    @Service
    @Transactional(propagation = Propagation.REQUIRED)
    public class SomeService {
    
        @Autowired
        private ApplicationContext applicationContext;
    
        private SomeService  getSpringProxy() {
            return applicationContext.getBean(this.getClass());
        }
    
        private void doSomeAndThenMore() {
            // instead of
            // this.doSometingPublicly();
            // do the following to run in transaction
            getSpringProxy().doSometingPublicly();
        }
    
        public void doSometingPublicly() {
            //do some transactional stuff here
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a single service method annotated with Propagation.Required . It performs three separate
I want to do this : @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public MyObject
I have the following test case: @ContextConfiguration(/spring/test-context.xml) @TransactionConfiguration(transactionManager=txManager) @Transactional() public class MyEntityDaoTestCase extends AbstractJUnit4SpringContextTests
I have a method as below: ClassA.java @Transactional public void methodA(){ ExecutorService executorService =
In my Spring application I have service-layer methods marked as @Transactional(propagation=Propagation.REQUIRED) and am using
Previously I have created a method updateRecord() in com.TestTransaction class. The updateRecord() method has
Suppose I have this: @Transactional(rollbackFor = NotificationException.class) public interface PersonManagerService { public void addPerson(Person
I have been trying this: @Transactional(isolation=Isolation.SERIALIZABLE, rollbackFor={Exception.class}, propagation=Propagation.REQUIRES_NEW) on my service methods, but spring
I have a question about Spring transaction propagation . Suppose I use @Transactional(propagation =
I have the following class: @Entity @Table(name=tbl_books) public class Book{ private int id_book; private

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.