Alex Rivera | Logout

@Autowire default mode

Asked 2011-04-14T15:00:19.737
27

How does Spring @Autowire beans: byName or byType? If one is not possible, is a second trial done using another mode?

Edit
Report

1 Answer

40

If annotated with @Autowired it will inject the bean with the matching type (An exception will be thrown if there are more than one of a type). To specify a name use the @Qualifier annotation.

answered 2011-04-14T15:10:33.877

Your Answer