org.unitils.spring.annotation
Annotation Type SpringBeanByType


@Target(value={FIELD,METHOD})
@Retention(value=RUNTIME)
public @interface SpringBeanByType

This annotation can be used on fields or setter methods, in order to inject a bean from a spring ApplicationContext. Unitils looks for a bean assignable the annotated field or setter method. If multiple beans are assignable, the most specific one is chosen. If none can be found that's more specific than all others, an exception is thrown. An ApplicationContext has to be configured for this test using the SpringApplicationContext annotation.

Author:
Filip Neven, Tim Ducheyne



Copyright © 2011. All Rights Reserved.