Announcement Announcement Module
No announcement yet.
testing with applicationContext Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • testing with applicationContext


    i'm building a few services that will eventrually end up in a web container, i would like to test them with along with ApplicationContext

    problem i can only have one applicationContext, ( and i know the web container willl automatically provide for me) so i was wondering how can emulate this, when my test class is a simple main classs (create a static Application Context?)

  • #2
    Most people use the Spring base classes (from spring-mock), but if you can't use JUnit for some reason, then you might have to do it yourself. Either call the constructor of the file system or classpath xml ApplicationContext directly, or set it up in a context reference and grab it using SingletonBeanDescriptor. I prefer the latter approach because I can re-use the configuration in a web app if necessary (by using a custom ContextLoader).


    • #3
      can you give me an example on how to use the SingletonBeanDescriptor, i'm using eclipse so i guess i can use mock, but i don't know how.