@Autowired
@Autowired annotations can be used to automatically connect beans in setter methods. Match in type mode.
A constructor @Autowired explains that when you create a bean, the constructor is automatically connected even if you do not use the element configuration bean in the XML file.
Mapping mode 1 using @autowired for variables, injecting other beans into the XML, you can omit the member variables of the configuration class from the injected object
Mapping mode 2 using @autowired for the set method and injecting other beans into the XML, you can omit the member variables of the configuration class from the injected object
Mapping mode 3 using @autowired for constructors and injecting other beans into the XML, you can omit the member variables of the configuration class from the injected object
Need to cooperate when using
<!--the beanpostprocessor will function automatically and automatically inject the Bean labeled @Autowired
<bean class= "Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
@Resource
function equal to @autowired, match in name mode
The explanation for @autowired and @resource is better than a reference http://www.cnblogs.com/xrq730/p/5313412.html
@Required
@Required comment The setter method applied to the Bean property, which indicates that the affected bean properties must be placed in the XML configuration file at configuration time, or the container throws a Beaninitializationexception exception.
@Component
This annotation tells the spring container to pick the beans while component-scanning is running.
@Repository
For DAO implement, you can automatically scan for adding DAO's beans by adding @repository
@Service
A implement that applies to a service (typically one serving is an abstraction of a DAO's services, directly invoking the DAO implementation Class), and can be implemented by adding @service to automatically scan the bean that adds the service
Application @[email protected] Reference
Need to cooperate when using<context:component-scan base-
package
=
"javabeat.net"
/>
http://javabeat.net/spring-annotations-component/
@Controller
Role: In the Springmvc application, tell the server that this class is the controller in MVC, which can receive user requests to process user requests
@Qualifier
When there are two implementation classes for an interface, you must use @qualifier to specify which implementation class to inject
Other annotations are described in other pages.
@Import
@PostConstruct
@PreDestroy
@Target
@Retention
@Configuration
@Bean
@Scope
Reference http://blog.csdn.net/zhang854429783/article/details/6785574
Spring Annotation Feature Notes