Spring boot 梳理 - Configuration Class
阿新 • • 發佈:2018-12-24
- 推薦使用 Java-based configuration ,也可以使用xml
- we generally recommend that your primary source be a single
@Configuration
class. Usually the class that defines themain
method is a good candidate as the primary@Configuration
- Importing Additional Configuration Classes
-
You need not put all your @Configuration into a single class
The @Import annotation can be used to import additional configuration classes.
Alternatively, you can use @ComponentScan to automatically pick up
all Spring components, including @Configuration classes.
-
- Importing XML Configuration
-
If you absolutely must use XML based configuration,
we recommend that you still start with a @Configuration class
You can then use an @ImportResource annotation to load XML configuration files.
-