• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about depends-on and order of creation

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, in Getting Started with Spring Framework,4th edition, on p.108


<bean id="serviceTemplate" class="...ServiceTemplate" depends-on="baseService" abstract ="true"/>
<bean id="someService class="...SomeService" parent="serviceTemplate"/>
<bean id="someOtherService class="...SomeOtherService" parent="serviceTemplate"/>
<bean id="baseService" class=..."BaseServiceImpl"/>
In the above example isting, someService and someOtherService child bean definitions of serviceTemplate don't inherit the depends-on attribute from the serviceTemplate bean definition. As the String container creates beans in the order in which they are defined in the application context XML file, the baseService bean is created after the creation of someService and someOtherService.


I think the baseService bean is created before the the creation of someService , someOtherService and even serviceTemplate bean.
It is because the first bean in the above serviceTemplate bean depends on baseService. So, the Spring container should create baseService bean first before the serviceTemplate.
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic