In this post under Spring Core, I will show with example how to use “@DependsOn” annotation to indicate dependencies between two beans marked with “@Component” annotation. For our example we have two beans “Bean1” and “Bean2” and both are annotated with “@Component” annotation. Now to declare that “Bean2” is dependent on “Bean1”, we annotate the…… Continue reading Using @DependsOn with @Component annotation
Tag: DependsOn
Using @DependsOn annotation
In this post under Spring Core, I will explain with example the purpose and how to use the “@DependsOn” annotation. In an Object Oriented Programming, no object is an island, it depends on other objects to perform their job. When Spring loads the application context, it creates the beans in following order. If a bean…… Continue reading Using @DependsOn annotation