junit5 give dependencies between extension

Declare a composed annotation to combine multiple annotations in a reusable way:

@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@ExtendWith({ DatabaseExtension.class,  WebServerExtension.class })  
public @interface DatabaseAndWebServerExtension {}

The extensions are registered in the order they are declared.

You can then use this annotation instead of the two individual ones:

@DatabaseAndWebServerExtension
public class MyDbTest {}

See the section on declarative extension registration in the JUnit 5 User Guide on the exact semantics.