Results 1 to 2 of 2

Thread: Testing autowire datasource

  1. #1

    Default Testing autowire datasource

    8.3.3. Transaction management

    AbstractTransactionalSpringContextTests depends on a PlatformTransactionManager bean being defined in the application context. The name doesn't matter, due to the use of autowire by type.
    My application uses Websphere data source in production and BasicDataSource in unit testing. So my bean configuration have two different data source types. When I tried to run the unit test case by extending AbstractTransactionalDataSourceSpringContextTests, it failed to autowire the datasource by type because I have two data sources.

    Is it possible for me to auto-wire by name? Or any other approaches?

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    You can set the autowireMode programmatically. The alternative is to split your configuration and extract out the changable elements. You can then include the unit test file in one environment and the websphere one in the other.
    http://www.springframework.org/docs/...owireMode(int)
    Last edited by karldmoore; Aug 27th, 2007 at 03:43 PM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

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