Annotation Interface AutoConfigureTestDb


@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented @Inherited @ImportAutoConfiguration @PropertyMapping("spring.test.database") public @interface AutoConfigureTestDb
Annotation that can be applied to a test class to configure a test database to use.
Author:
Jeff Fischer
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
     
    boolean
     
     
    boolean
    Whether notification handling runs inline on the thread that committed the change, rather than on the notification thread pool.
  • Element Details

    • hsql

      boolean hsql
      Default:
      true
    • networkAccessible

      boolean networkAccessible
      Default:
      false
    • replace

      String replace
      See Also:
      • org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabase#replace()
      Default:
      "AUTO_CONFIGURED"
    • synchronousNotifications

      @PropertyMapping(skip=ON_DEFAULT_VALUE) boolean synchronousNotifications
      Whether notification handling runs inline on the thread that committed the change, rather than on the notification thread pool.

      Defaulted on. NotificationManager#handleAsync(..) otherwise lets a message send, the consumer that send loops back into, and the notification state write that acknowledges it, all outlive the test method that caused them - which is a race against the next test's fixture, and against any assertion made immediately after the operation under test.

      Turn it off for a test that is deliberately asserting on pooled behavior. Note that doing so makes that test responsible for its own fence; draining a collector is not one.

      See Also:
      Default:
      true