-
Notifications
You must be signed in to change notification settings - Fork 116
Description
https://docs.spring.io/spring-boot/docs/2.7.x/reference/html/howto.html#howto.testing.slice-tests
Auto-configuration Registration
If you have created your own auto-configurations, you should move the registration from spring.factories to a new file named META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports. Each line contains the fully qualified name of the auto-configuration. See the included auto-configurations for an example.For backwards compatibility, entries in spring.factories will still be honored.
So:
- Any
src/main/resources/META-INF/spring.factoriesfile should move toMETA-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports - the comma separate value for key
org.springframework.boot.autoconfigure.EnableAutoConfigurationshould be split across separate lines.
New @autoConfiguration Annotation
A new @autoConfiguration annotation has been introduced. It should be used to annotate top-level auto-configuration classes that are listed in the new META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports file, replacing @configuration. Configuration classes that are nested within or imported by an @autoConfiguration class should continue to use @configuration as before.For your convenience, @autoConfiguration also supports auto-configuration ordering via the after, afterNames, before and beforeNames attributes. This can be used as a replacement for @AutoConfigureAfter and @AutoConfigureBefore.
So:
- Replace usage of
@Configurationwith@AutoConfigurationwhere classes are mentioned in the above replacedsrc/main/resources/META-INF/spring.factories
Test Slice Configuration
If you have created your own test-slices, you should move the registration from spring.factories to the new place under META-INF/spring/.imports. The format is the same as the new file described in the "Auto-configuration Registration" section, see above.
Above steps are complicated even more for users defining their own test slices, requiring a different filename with the same one class per line structure as above.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status