Skip to content

Introduce @SqlConfig for common SQL script configuration [SPR-11896] #16515

@spring-projects-issues

Description

@spring-projects-issues

Sam Brannen opened SPR-11896 and commented

Status Quo

#12311 introduced support for declarative SQL script execution via the @Sql annotation in the Spring TestContext Framework (TCF). @Sql provides attributes for configuring the syntax of the referenced SQL scripts as well as exception handling and transaction behavior.

Early feedback from developers has shown that although this level of configuration (i.e., at the @Sql annotation level) is useful, it is often times a burden on the developer to declare the exact same configuration for each test method within a test class or test class hierarchy. It would therefore be very beneficial to be able to declare common, shared SQL configuration across a test class hierarchy.

Deliverables

  1. Introduce a class-level annotation for declaring common SQL script configuration -- for example, @SqlConfig
  2. Common configuration must be able to be overridden via method-level @Sql configuration.
  3. Avoid unnecessary duplication of code and documentation by replacing existing configuration attributes in @Sql with a single config attribute of type @SqlConfig.
  4. Furthermore, all attributes of @SqlConfig must be either of type String or custom enums in order to support overriding. Empty values would therefore imply use of a default or inherited value.

Affects: 4.1 RC1

Issue Links:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions