Spring @Component and @ComponentScan annotation example

In this post under Spring Core, I will show with example the purpose and how to use “@Component” and “@ComponentScan” annotation together. Till now in all my previous post, I have been defining a bean using “@Bean” annotation in an “@Configuration” annotated class as shown below package package1;import org.springframework.context.ApplicationContext;import org.springframework.context.annotation.AnnotationConfigApplicationContext;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;@Configurationpublic class Example1 {…… Continue reading Spring @Component and @ComponentScan annotation example