SpringSource Spring Framework tutorials and examples. Focusing on Spring 3 and above.
Similarly to lists, there are times when you will need to map to other types of collections. In this tip, I will outline what you need to do to wire sets, maps and properties. The key to remember is that you want to wire your bean to the same type that is being used in the class definition. So if your bean has a java.util.Set property to guarantee uniqueness in the collection, you want to use the same definition in the xml definition.
So for example, if you want to use a java.util.Set,
Rather than configure beans separately and allow for Spring’s DI container to manage the injection of these beans into other beans, another means of wiring bean references is to embed a <bean> element directly in the <property> element. For example, the carDao property of the carService bean can be wired as follows: Java Code: <bean id="carService" class="com.acme.springexample.service.CarServiceImpl">
<bean id="carService" class="com.acme.springexample.service.CarServiceImpl">
Updated 11-30-2011 at 11:51 AM by Spring Framework
When you configure a new Spring beanBy default, all Spring beans are singletons. When the container dispenses a bean, it will always give the exact same instance of the bean. But sometimes you want the application context to return a unique instance for each time you request a specific bean. In this case, you would want to do is to define a prototype bean. When you define a prototype means that you define a blueprint of the bean. Every subsequent bean for this requested bean will be based on this