Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 1.2 KB

README.md

File metadata and controls

32 lines (22 loc) · 1.2 KB

Spring Dependency Injection example without XML

Simplest example how can Spring Dependency example works. For all configuration are used annotations without any XML files.

Description

  • 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

Interesting reading

Spring Depedency Injection and Beans

  • 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

More demos