In this post under Spring Core, I will show with example how to give custom id to beans. Whenever we define a bean with @Bean annotated method, we do it as below @Bean public Bean1 bean1() { return new Bean1(); } The bean id by default will be same as method name. So in the…… Continue reading Giving custom name to @Bean annotated beans
Tag: Bean
Spring @Bean and @Configuration Simple Example
In this post under Spring Core, I will explain with example the purpose of “@Bean” and “@Configuration” annotation. Earlier before the introduction of annotations in Spring project, we used to define beans in xml file. For example if we had a classes as shown below package package1; public class Bean1 { @Override public String toString()…… Continue reading Spring @Bean and @Configuration Simple Example