• 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

Spring and plugging in null implementations

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on making my Struts and Spring application more testable. As part of that, I've seperated the Spring configuration dealing with each layer of my application into separate files. So, one for the web stuff (Struts action classes, etc), one for a service layer and one for a DAO layer. When I'm testing the struts action classes (with StrutsTestCase), I want to configure Spring to give me an action class with the dependencies null. I need to keep Spring in the mix (although I'd rather not) because of the way I'm integrating Spring and Struts. See http://www-128.ibm.com/developerworks/java/library/j-sr2.html Option #3 for a description of my approach. I know I could put the null in place if I kept a seperate instance of my web config file and used a <null> attribute. However, I don't want to do that. I'd rather replace my regular service config file with a testing one. Maybe I can illustrate:

Here's a snippet from ApplicationContext-web.xml:


Here's the ApplicationContext-service-test.xml:


Any ideas?

Thanks,
Ben
 
reply
    Bookmark Topic Watch Topic
  • New Topic