Skip to content

Pooky/dependency-injection-spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simplest example of dependency injection with Spring

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages