Ich benutze Spring 4.3.8.RELEASE mit Hibernate 5.1.5.Final. Ich möchte eine Methode ausführen lassen, nachdem eine andere Transaktion abgeschlossen ist. Diese Transaktion ist definiert unterWny bekomme ich "java.lang.IllegalStateException: No TransactionalEventListener Annotation"?
@Service("organizationService")
@Transactional
public class OrganizationServiceImpl implements OrganizationService, ApplicationEventPublisherAware
{
private ApplicationEventPublisher publisher;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher publisher)
{
this.publisher = publisher;
}
@Override
public void save(Organization organization)
{
...
// sync data with ThirdParty but only if something has definitelychanged on the SB
// side, in which case we want to send ThirdParty an update.
if (!hasSameAttributes)
{
publisher.publishEvent(new ThirdPartyOrganizationEvent(organization.getId()));
} // if
} // save
So, hier ist die Methode, die ich ausgeführt werden soll, nachdem die obige Transaktion abgeschlossen ...
@Service
public class ThirdPartyAPIServiceImpl implements ThirdPartyAPIService
{
@Override
@TransactionalEventListener
public boolean updateOrg(final ThirdPartyOrganizationEvent thirdPartyOrgEvent)
{
...
}
Aber wenn ich meinen Anwendungskontext laden bekomme ich diesen Fehler
Caused by: java.lang.IllegalStateException: No TransactionalEventListener annotation found on method: public abstract boolean org.mainco.subco.myproject.service.ThirdPartyAPIService.updateOrg(org.mainco.subco.myproject.domain.ThirdPartyOrganizationEvent)
at org.springframework.transaction.event.ApplicationListenerMethodTransactionalAdapter.<init>(ApplicationListenerMethodTransactionalAdapter.java:55)
at org.springframework.transaction.event.TransactionalEventListenerFactory.createApplicationListener(TransactionalEventListenerFactory.java:55)
at org.springframework.context.event.EventListenerMethodProcessor.processBean(EventListenerMethodProcessor.java:159)
at org.springframework.context.event.EventListenerMethodProcessor.afterSingletonsInstantiated(EventListenerMethodProcessor.java:104)
... 34 more
Wbat muss ich tun, um diese Konfiguration richtig zu konfigurieren?