Transactional annotation on a Spring service method not picked up

I spent several hours trying to hunt down why a @Transactional annotation on a method was not being picked up. It was picked up on various other method, but not on this particalar service which only contains one method.

@Component
public class SomeHelper {
 
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    protected ReturnType doSomething(String paramater) {
        // handling code
    }
 
}

There are also some autowired components in there which were working.

Several hours later, I found it.

protected

Apparently the annotation is only applied to public methods.

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

*