SpringSource/spring-scala — pull request #21 by hekonsek (2013-05-21 12:36:42+00:00)
Title: Added basic support for Spring Test.

Hi,

Current version of Spring Scala doesn't play well with the existing Spring Test infrastructure. There is much to be done in this area, but the fundamental issue is probably the lack of `ContextLoader` dedicated for the `FunctionalConfiguration` classes (as reported by @nfrankel).

I created `FunctionalConfigContextLoader` class and `FunctionalConfigurations` annotation to make it possible to wire functional configurations into the Spring Test JUnit runner.

@RunWith(classOf[SpringJUnit4ClassRunner])
@ContextConfiguration(loader = classOf[FunctionalConfigContextLoader])
@FunctionalConfigurations(classOf[TestConfig], classOf[AnotherTestConfig])
class ScalaJUnitTests {

@Autowired
var stringBean : String = _

@Test
def someTest() {}

}

I deliberately do not use `@ContextConfiguration.classes` property to provide the list of `FunctionalConfiguration` classes, as the contract of this property clearly states that it should be used only to specify `@Configuration` classes.

There is much more that could be done to improve the experience of Spring Scala users with Spring Test. This contribution would be the very first move toward this effort.

Cheers.