Simplest example how can Spring Dependency example works. For all configuration are used annotations without any XML files.
- All configuration is in pooky.projects.AppConfig
- This class need to be annotated with @Configuration
- Annotation @ComponentScan will scan and register beans in pooky.projects.beans
- To run example use Main.java
Spring Depedency Injection and Beans
- Difference between annotation @Inject, @Resource and @Autowired
- https://blogs.sourceallies.com/2011/08/spring-injection-with-resource-and-autowired/
- In Spring Component can have constructor, which include specific Bean and you don´t have to write @Autowired there
- Otherwise you have to use @Autowired or other import annotation
- Java EE World examples can be found here: https://github.com/Pooky/java-enterprise-examples
- Spring Wordl examples can be found here: https://github.com/Pooky/spring-examples