In my Spring Boot project I have implemented following service method:
@Transactional
public boolean validateBoard(Board board) {
boolean result = false;
Using "self" inject pattern you can resolve this issue.
sample code like below:
@Service @Transactional
public class YourService {
//... your member
@Autowired
private YourService self; //inject proxy as an instance member variable ;
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void methodFoo() {
//...
}
public void methodBar() {
//call self.methodFoo() rather than this.methodFoo()
self.methodFoo();
}
}
The point is using "self" rather than "this".