Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
8 Cards in this Set
- Front
- Back
Spring's primary wiring mechanisms |
1. Explicit configuration in XML 2. Explicit configuration in Java 3. Implicit bean discovery and automatic wiring |
|
Automatically wiring beans |
1. Component scanning—Spring automatically discovers beans to be created in theapplication context. 2. Autowiring—Spring automatically satisfies bean dependencies. |
|
@Component |
This simple annotation identifies this class as a component class andserves as a clue to Spring that a bean should be created for the class. There’s no needto explicitly configure a bean; Spring will do it for you because this class isannotated with @Component. |
|
@Component Configuration |
Component scanning isn’t turned on by default, however. You’ll still need to writean explicit configuration to tell Spring to seek out classes annotated with @Componentand to create beans from them. |
|
@Component Configuration Java Class |
package soundsystem; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @ComponentScan public class CDPlayerConfig { } |
|
@Component Configuration XML |
to be studied |
|
Naming a component-scanned bean |
1. By passing ID to the @Component Example @Component("lonelyHeartsClub") public class SgtPeppers implements CompactDisc { 2. By using @Named annotation from the Java Dependency Injection specification(JSR-330) to provide a bean ID: Example package soundsystem; import javax.inject.Named; @Named("lonelyHeartsClub") public class SgtPeppers implements CompactDisc { |
|
base package for component scanning |
to be studied |