import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; public class IngesterCircularReferencesTest { @Test public void circularReferencesTest() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(); context.setAllowCircularReferences(false); String[] configLocations = new String[] { "/your-beans.xml" }; context.setConfigLocations(configLocations); context.refresh(); context.close(); } }
New ideas pass through three periods:
1) It can’t be done.
2) It probably can be done, but it’s not worth doing.
3) I knew it was a good idea all along!
- Arthur C. Clarke
Thursday, 19 June 2014
How to test circular dependencies in Spring
This will raise an exception if your dependencies have circular dependency problem
Etichette:
circular dependencies,
Spring
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment