I have service like this:
class ServiceImpl implements Service {
@Override
@Transactional
public int method() {
//some logic in transaction
method2();//I want run this without transaction
return 2;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void method2() {
//external api call
}
}
How can I run method2 without transaction or in new transaction? Can I run in my controller class this 2 method like this:
service.method();
service.method2();