Back Forum Reply New

Any existing way to make sure beans defined in spring xml are stateless?

Working on a large size project, we started to use spring to manage our dependency injection. Since most dev are migrated from coding stateful class, we found some of stateless bean actually contain instance variables which themself are stateful. Of course, for each one of those bugs, trouble shooting took forever.

Correct me if I am wrong, it shouldn't be too tough to write a unit test to verify that all the stateless bean defined in spring xml actually is stateless (i.e. bean shouldn't have any instance variable which never defined in spring xml). Before I will try myself to write one, wonder if there is any existing tool out there to check that?

Thx
¥
Back Forum Reply New