Hey,
I wonder if it is possible to use @PreDestroy
annotation and work with cuba ORM methods and don’t face thread race. Eg my Component will have some cached data he worked with and i need to commit them before application close.
Handle AppContextStoppedEvent
event instead. It is fired right before stopping the application.
See Application Lifecycle Events.
There is no guaranteed order of @PreDestroy
in Spring.
1 Like
Thanks. Exactly what i have tried to avoid
I believe there is typo in docs example.
@EventListener
should be at least in protected
visibility scope.
org.springframework.beans.factory.BeanInitializationException: Failed to process @EventListener annotation on bean with name 'atl_PostQueueController'; nested exception is java.lang.IllegalStateException: Need to invoke method 'onAppStopped' found on proxy for target class 'PostQueueController' but cannot be delegated to target bean. Switch its visibility to package or protected.