Register a Spring Bean in the Spring IoC Container
Using Java Annotations
// Controller.java @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Component public @interface Controller { /** * The value may indicate a suggestion for a logical component name, * to be turned into a Spring bean in case of an autodetected component. * @return the suggested component name, if any (or empty String otherwise) */ @AliasFor(annotation = Component.class) String value() default ""; }
Registering Beans Directly in a Bean Configuration File and Retrieving Beans Using ApplicationContext
Last updated