I have a class that extends AbstractMongoEventListener and overrides onAfterSave and onAfterDelete.
The onAfterDelete does not trigger for some reason. The onAfterSave works fine.
Is there a different configuration that needs to be done for it?
public class ClassX extends AbstractMongoEventListener<DomainClass> {
@Override
public void onAfterSave(AfterSaveEvent<DomainClass> event) {
//dosomething
}
@Override
public void onAfterDelete(AfterDeleteEvent<DomainClass> event) {
//dosomething
}
}
I have already checked the database and the data is being properly deleted, but the onAfterDelete still don't get called.
Any suggestion of what could be the problem?
The repository:
public interface DomainClassRepository extends MongoRepository<DomainClass, String> {
}
I'm calling the method DomainClassRepository.delete(instanceOfDomainClass) to delete the entry in the db.