Rahul Sharma Rahul Sharma - 1 year ago 89
Java Question

Merging @Sql from superclass with @Sql in subclass

I have an abstract class annotated with

@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts="someScript")

I have a test class which inherits from the abstract class. The child class is also annotated with
@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts="someOtherScript")

When I was running spring boot 1.2, everything worked as I expected it to: scripts from parent class were run before child class. I upgraded to spring boot 1.3 and now, the child class's
overrides parent class's
and the parent class scripts are never run.

With spring boot 1.3 is there a different way of doing this? So that parent class scripts are run before child class scripts?

Answer Source

After @SamBrannen's answer, I ended up running the script from child class using ScriptUtils.execute method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download