@Scope ("prototype")
If the action does not @scope ("prototype"), it is possible to report that xxxaction error is not found! Writing this means that each request is re-created with an action corresponding to Singalon, commonly known as " multiple cases ".
@Service ("AAAAA"). This bean is "singleton" by default.
--------------------------------------------------------------------------------------------------------------- -------------------------------------------
@Service
Used for labeling business layer components, note the annotations in the implementation class, and do not comment on the interface. Use an excuse when referencing in action
Interface
Interface implementation
In action
@Controller
For labeling control-layer components, such as action in struts
@Repository
For labeling data Access Components, DAO components
@Component
We can use this annotation to annotate components when they are poorly categorized. The previous 3 comments and @Component are equivalent, but from the name of the annotation class it is easy to see that the 3 annotations correspond to the persistence layer, the business layer, and the control layer (the WEB layer), respectively.
--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------
@Autowired
The getter () and setter () methods are not required, and spring can be automatically injected
@Qualifier
If more than one implementation class is available for this tag, specify which implementation class to inject, otherwise you can omit, write only @autowired
--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------
Configuring annotations in the Spring container
<context:annotation-config/>
<context:component-scan base-package= "Com.xxx.xxx.base" >
<context:include-filter type= "Annotation"
expression= "Org.springframework.stereotype.Repository"/>
</context:component-scan>
,,,,,,,,
<context:annotation-config> is used to activate beans that have already been registered in the Spring container(either through XML or through the package Sanning way) above the annotations.
<context:component-scan> in addition to having <context:annotation-config> functions,<context:component-scan> You can also scan and register JavaBean under the specified package.
with <context:component-scan>, another <context:annotation-config/> tag can be removed at all, because it is already included.
<context:component-scan> provides two sub-tags:<context:include-filter> and <context:exclude-filter> filters introduced and excluded by each representative.
Context:include-filter for include, I understand that in addition to scanning the subclasses below the Base-package package, the package behind expression is also scanned.
Context:exclude-filter for exclude, I think even if the package behind expression is under base-package, it does not scan.
Quoted a lot of
A brief explanation of spring annotations