Lazy Initialize @Autowired Dependencies with @Lazy
By default all autowired dependencies are eagerly created and configured at startup. When the @Lazy annotation is present together with the @Component annotation on class level, then the component will not be eagerly created by the container, but when the component is first requested. Together with the @Autowired injection point, you need to mark it with @Lazy annotation.
Read full article from Lazy Initialize @Autowired Dependencies with @Lazy
No comments:
Post a Comment