Skip to content
krosenvold edited this page Sep 13, 2010 · 11 revisions

Spring context analyzer analyses spring contexts looking for errors.

Usage (in a spring-aware unit test):


SpringContextAnalyzer springContextAnalyzer = new SpringContextAnalyzer(applicationContext); List<Problem> problems = springContextAnalyzer.analyzeCurrentSpringContext(); assertEquals(springContextAnalyzer.describe( problems), 0, problems.size());

The analyzer currently understands two different errors:
Any field in a singleton bean that us NULL upon complete bean initialization is an error.
Any singleton bean using a session/request scoped bean without a scope proxy is an error.

The analyzer also contains a list of known exceptions to the NULL rule. This list is still in its very early phases.


git clone  git://github.com/krosenvold/spring-context-analyzer.git spring-context-analyzer
cd spring-context-analyzer
mvn install


            <dependency>
                <groupId>com.rosenvold.spring</groupId>                                
                <artifactId>spring-context-analyzer</artifactId>
                <scope>test</scope>
                <version>0.3</version>
            </dependency>

Clone this wiki locally