The console log

The following are some of the important statements from the log once the context is launched using LaunchJavaContext. Let's quickly review the log to get a deeper insight into what Spring is doing:

The first few lines show the component scan in action:

Looking for matching resources in directory tree [/target/classes/com/mastering/spring]

Identified candidate component class: file [/in28Minutes/Workspaces/SpringTutorial/mastering-spring-example-1/target/classes/com/mastering/spring/business/BusinessServiceImpl.class]

Identified candidate component class: file [/in28Minutes/Workspaces/SpringTutorial/mastering-spring-example-1/target/classes/com/mastering/spring/data/DataServiceImpl.class]

defining beans [******OTHERS*****,businessServiceImpl,dataServiceImpl];

Spring now starts to create the beans. It starts with businessServiceImpl, but it has an autowired dependency:

Creating instance of bean 'businessServiceImpl'Registered injected element on class [com.mastering.spring.business.BusinessServiceImpl]: AutowiredFieldElement for private com.mastering.spring.data.DataService com.mastering.spring.business.BusinessServiceImpl.dataService 

Processing injected element of bean 'businessServiceImpl': AutowiredFieldElement for private com.mastering.spring.data.DataService com.mastering.spring.business.BusinessServiceImpl.dataService

Spring moves on to dataServiceImpl and creates an instance for it:

Creating instance of bean 'dataServiceImpl'
Finished creating instance of bean 'dataServiceImpl'

Spring autowires dataServiceImpl into businessServiceImpl:

Autowiring by type from bean name 'businessServiceImpl' to bean named 'dataServiceImpl'
Finished creating instance of bean 'businessServiceImpl'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset