In my Spring application, I have a bean with a request scope:
@Component
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
public class MyBean {
@PostConstruct
public void init() {
...
}
I also have a MongoDB event handler:
@Component
@RepositoryEventHandler
public class MyEventHandler {
@HandleBeforeCreate
public void beforeCreateInstance(Object instance) {
...
}
}
When I call Spring the REST data endpoint to save my resource, it starts first @HandleBeforeCreateand then it @PostConstructis called.
How can I reorder these calls? I would like to call @PostConstructon MyBeanbefore MongoDB event handlers are removed?
source
share