Results 1 to 1 of 1

Thread: AbstractTransactionalSpringContextTests lazy loading beans

  1. #1
    Join Date
    Sep 2011
    Posts
    8

    Thumbs up AbstractTransactionalSpringContextTests lazy loading beans

    Hi ,

    I had written class which extends “AbstractTransactionalSpringContextTests” for testing my beans instantiated via spring framework .

    I had annotated all java classes eligible for spring to load with @Service,@Autowire,@Qualifier in XML along with component scanning with pkg which has annotated classes .

    Issue I face when I tried to inject properties (with autowire ) for classes which is not apart of component scanning ( I purposefully left those packages in scanning, as I am not interested in testing / loading the class)
    Spring does because required is set to true by default in Autowired class.

    Hence to resolve this issue , I added “default-lazy-init="true" in xml , which resolved my issue .

    Even with “AbstractTransactionalSpringContextTests” we have that option using “setDependencyCheck(false) ".it is not working as expected .

    I prefer way to do in test class level , rather than changing xml ( FYI going fwd we would like to use same XML for application and testing )

    Thanks in advance .
    Ganesh Gowtham
    Last edited by grgowtham; Oct 11th, 2011 at 07:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •