-
Notifications
You must be signed in to change notification settings - Fork 12
CT Component
Aditya Ketkar edited this page Feb 18, 2018
·
5 revisions
Component annotation (@Component)
The @Component
annotation marks a java class as a bean so the component-scanning mechanism of Spring can pick it up and pull it into the application context. To use this annotation, apply it over class as below:
@Component("interfaceAImpl_1")
public class InterfaceAImpl implements InterfaceA {
...
}
The above annotation only works if the class using another class as bean is in the same package. For extending the scan mechanism to another package we use ComponentScan
.
The scanning mechanism can manually be invoked by using the @ComponentScan
annotation. An example can be found below :
@ComponentScan(basePackages = {
"in.ac.bits.protocolanalyzer.persistence.repository",
"in.ac.bits.protocolanalyzer.analyzer.network"
}
- Development Workflow
- Coding Standards
- Coding Style
- Code Profile
- Coding Tutorials
- Branch History
- Refactoring Suggestions