Spring 3 and JSR-330 Annotation : @Named and @Component Difference

@Named and @Component annotations are used for the same purpose. Both the annotations are used for enabling a class to be auto detected as the bean definition for spring’s application context. The following are the main different of these two annotations.

  1. @Named is part of the. Java specification. It is more recommended since this annotation is not tied to spring APIs. If you migrate your applications, you can continue use this annotation.
  2. @Component is part of the spring’s annotations library. It is similar to the @Named annotation in functionality.
package javabeat.net.core.ioc;

public class SpringBeanNamed {


public class SpringBeanComponent {


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>