Spring Framework
  1. Spring Framework
  2. SPR-4333

TestContextManager has hidden dependency on spring-tx

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.5.2
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      TestContextManager has hidden dependency on spring-tx. I can't run a test with @RunWith(SpringJUnit4ClassRunner.class) without putting spring-tx.jar on the classpath, which isn't actually required by the test case.

        Activity

        Hide
        Juergen Hoeller added a comment -

        This is not really a "hidden" dependency - it's simply the default TransactionalTestExecutionListener doing its work. If you don't specify explicit @TestExecutionListeners, the defaults will kick in... implying the dependencies of those defaults.

        Anyway, this is easy enough to solve through a catch block when instantiating the default TestExecutionListeners. If a default listener cannot be instantiated, we'll simply assume that it isn't needed since its underlying dependencies aren't present - which means that the application's test code cannot make use of those underlying facilities (e.g. @Transactional) either.

        Juergen

        Show
        Juergen Hoeller added a comment - This is not really a "hidden" dependency - it's simply the default TransactionalTestExecutionListener doing its work. If you don't specify explicit @TestExecutionListeners, the defaults will kick in... implying the dependencies of those defaults. Anyway, this is easy enough to solve through a catch block when instantiating the default TestExecutionListeners. If a default listener cannot be instantiated, we'll simply assume that it isn't needed since its underlying dependencies aren't present - which means that the application's test code cannot make use of those underlying facilities (e.g. @Transactional) either. Juergen

          People

          • Assignee:
            Juergen Hoeller
            Reporter:
            Dave Syer
            Last updater:
            Trevor Marshall
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              6 years, 14 weeks, 6 days ago