@SpringJUnitConfig

Veröffentlicht am: 26 März 2024
auf dem Kanal: JavaAnatomy
199
3

@ExtendWith(SpringExtention.class)
@ContextConfiguration(ConfigClass)
Are always used in combination.


@SpringJUnitConfig(ConfigClass)
Combines these two annotations into one annotation. Spring recommends using this annotation instead of the two.

If you don’t want to include a configuration class as an argument to @SpringJUnitConfig

You can also specify a Test configuration class nested inside
@SpringJUnitConfig. Then Spring will look for config class inside the class annotated with @SpringJUnitConfig

This is important when we want specific configurations only for a particular test class. E.g, we may want a specific DataSource for a particular test class

@SpringJUnitWebConfig is a composed annotation that combines
@ExtendWith(SpringExtension.class)
@ContextConfiguration and
@WebAppConfiguration from the Spring TestContext Framework.

You can use it at the class level as a drop-in replacement for @ContextConfiguration and @WebAppConfiguration.

@SpringJUnitWebConfig combines the same annotations of @SpringJUnitConfig plus the @WebAppConfiguration from Spring testing – to load the WebApplicationContext.


Auf dieser Seite können Sie das Online-Video @SpringJUnitConfig mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer JavaAnatomy 26 März 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 199 Mal angesehen und es wurde von 3 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!