how to execute a method after all beans are initialized?
hi
i have quite a simple issue with which i'm struggling with for 2 days now.
i want to perform some caching/storing method after the container is done initializing all my beans. that's because my operation is depending on several different services which are injected by @Autowired so just calling it when the containing bean is initialized is not enough.
i tried using the init() method or a @PostConstruct annotation in my service but it turns out that not all the beans that it depends on were fully initialized at the time of the call - at least one of my dependencies has its own dependencies autowired after the call, so i get a NullPointerException while i try to use it.
i was hoping i can resolve this by annotating that bean with @DependsOn(..dependency names..) but unfortunately it didn't help much.
there has to be some easy way to perform some method when the Spring container is done initializing all beans, hasn't there?