No Transaction problem in service
Hello,
i have an strange issue with my applicationContext and hope someone can give me a hint to solve my problem.
I have a service inteface with an service method that i want to be scheduled.
Code:
public inteface MyService {
String BEAN_NAME = "myService";
void doWork();
}
And thats my implementation:
Code:
@Service(MyService.BEAN_NAME)
@Transactional(propagation = Propagation.SUPPORTS)
public class MyServiceImpl implements MyService {
@Transactional(propagation = Propagation.REQUIRED)
@Scheduled(cron = "*/15 * 7-19 * * *")
@Override
public void doWork() {
...
}
}
This servicemethod was executed until yesterday in an transaction like defined every 15 seconds. I don't know what I changed but I have the problem that the method isn't in a transaction. If I analyse the stacktrace when I have an breakpoint in the method, I see that the method isn't going through the TransactionInterception. And I don't know why or what I had changed.
I was so desperated that I made a copy of the implementation (MyServiceImplClone) with exactly the same content with a different beanname. And what I don't understand that this clone version method passes the TransactionInterceptor and is invoked in a transaction.
When I don't bind the original Service to the applicationContext then I have the same problmes with the copy service again.
Can anyone explain or give a hint about this? I don't really know what I changed or what the problem is.