• 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

How Spring loads spring configuration files ?

 
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have Spring web application which contains basic steps
1) Web.xml file where we configure DispatcherServlet



where i found one configuration file test-servlet.xml .


But i very curious about how & when this file is getting loaded into the web-container.

there is no defination for this file any where in web-xml ...

is i am missing anything , please update !
 
Ranch Hand
Posts: 277
Oracle Spring Flex
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

When the server is started, the web.xml file is loaded. The Dispatcher servlet registered helps to find out the xml file.
It searches for xml file with name <servlet-name>-servlet.xml and loads it.
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes correct thanks !

I was confused like contextLoaderLister and ApplicationContext.xml files getting loaded as it is configured same way !

again thanks !

any good toutrial on spring , please let me know !
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prabhat Ranjan wrote:yes correct thanks !

I was confused like contextLoaderLister and ApplicationContext.xml files getting loaded as it is configured same way !

again thanks !

any good toutrial on spring , please let me know !



Yes and no. Sort of. Basically the DispatcherServlet creates an ApplicationContext, but really should only contain the beans for the Web Layer, no middle tier beans. So for the middle tier beans are loaded via the ContextLoaderListener which creates its own ApplicationContext.

So typically you end up with two ApplicationContexts. One for the middle tier and one for the web layer. Where the web layer beans can have the middle tier beans injected into them.

Mark
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can we give example for both the middle tier beans and web beans , as web beans i know probably and middle tier beans means non-web spring application.

is it like that ?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prabhat Ranjan wrote:can we give example for both the middle tier beans and web beans , as web beans i know probably and middle tier beans means non-web spring application.

is it like that ?



Yes, If I had a Spring MVC app, the web beans are my Controllers, ViewResolvers and MappingHandlers. The middle tier are my Services, Repositoryies, TransactionManager, DataSource, etc.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic