Announcement Announcement Module

JavaConfig forum decommissioned in favor of Core Container

As described at

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at
See more
See less
Is there TestNG integration for JavaConfig? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there TestNG integration for JavaConfig?

    Hello All,
    JavaConfig looks very promising and I can't wait to integrate it into my next project. Is there any TestNG integration?

    Presently I use AbstractTestNGSpringContextTests as well as XML config and <context: property-placeholder../> plus a properties file (for machine-specific information, like passwords).

    Are these features available in Spring JavaConfig?

    Thanks in Advance,
    Last edited by JavaGeek_Boston; Oct 15th, 2008, 01:15 PM.

  • #2
    I'm also interested in these features...


    • #3
      I wonder if you could use the "loader" attribute of @ContextConfiguration by writing a custom ContextLoader that returns your JavaConfigApplicationContext.

      I'll try this out over the next few days and post my results.

      Anyone else tried this?


      • #4
        There is a JavaConfigContextLoader implementation in the latest m4 snapshots. This should get you what you're looking for.

        Steven, as to your question about property-placeholder, equivalent support is available with the combination of @PropertiesValueSource and @ExternalValue. Again, these are both available in the nightlies. See the javadoc and unit tests for examples of use. And, of course, feel free to ask questions here.


        • #5
          Thanks Chris,

          I used some of the code from the m4 snapshot to write a custom ContextLoader and everything works great. I'll switch over to the correct loader once m4 is out.