timmorrow
Dec 5th, 2006, 10:03 AM
The problem I'm trying to solve is to verify that the classpath provides all the classes needed by the beans in a set of XML files. I'd like to do this as often as possible (say as a unit test run during a build). An additional feature would be to verify bean references too.
I realize that unit tests shouldn't load Spring beans. But this is because the beans have dependencies (database, JMS, JNDI) that aren't available to unit tests.
This technique would be a special way of loading the spring beans without actually instantiating any of them. I did this once before using Spring 1.x by traversing the beans in a bean factory and manually verifying bean references. IIRC Spring verified the classes for me. However, I don't think I took care of all types of bean references like idref and the like.
I was hoping that perhaps with Spring 2.x there is perhaps a built-in method for doing this? For example, is there a way to make a BeanFactory be lazy, without having to set that property in the XML file itself?
Any suggestions would be appreciated,
Thanks,
Tim
I realize that unit tests shouldn't load Spring beans. But this is because the beans have dependencies (database, JMS, JNDI) that aren't available to unit tests.
This technique would be a special way of loading the spring beans without actually instantiating any of them. I did this once before using Spring 1.x by traversing the beans in a bean factory and manually verifying bean references. IIRC Spring verified the classes for me. However, I don't think I took care of all types of bean references like idref and the like.
I was hoping that perhaps with Spring 2.x there is perhaps a built-in method for doing this? For example, is there a way to make a BeanFactory be lazy, without having to set that property in the XML file itself?
Any suggestions would be appreciated,
Thanks,
Tim