Wednesday, 23 July 2008

Spring Autowiring tip

How to exclude a bean from being available for auto wiring?

When configuring beans in configuration file, the 'autowire-candidate' attribute of the element can be set to 'false'; so that this bean can not be made available for auto wiring infrastructure.

For example : <bean id="foo" autowire-candidate="false">
would not allow bean "foo" to be autowired to another bean referring "foo".


No comments: