How to instantiate beans of same type with different bean ids using JavaConfig ?
In the simple case for one bean definition in XML would be say :
<beans>
<bean id="helloWorld" class="com.blah.HelloWorld" />
</beans>
The equivalent of this in JavaConfig would be:
package com.blah;
import org.springframework.context.annotation.*;
@Configuration
public class HelloWorldConfig {
@Bean
public HelloWorld helloWorld(){
return new HelloWorld();
}
}
So extending this to more than one bean
<beans>
<bean id="helloWorld" class="com.tutorialspoint.HelloWorld" />
<bean id="helloWorldAgain" class="com.tutorialspoint.HelloWorld" />
</beans>
What would be equivalent JavaConfig to this?