如果 你需要构造 有等级的ApplicationContext(容器上下文) (有 父/子 关系的 多个上下文)[multiple contexts with a
parent/child relationship],或者你 只是喜欢使用 快速构建 API ,你可以使用 SpringApplicationBuilder
在 SpringApplicationBuilder 中,允许你连条调用多个方法,包括父类 和 子类的方法
来创建你的 等级。
For example
public static void main(String[] args) {
new SpringApplicationBuilder().bannerMode(Banner.Mode.OFF)
.sources(Parent.class).child(ApplicationCH.class).run(args);
}
Note
在你创建ApplicationContext层级 时,有一些限制。
Web 组件必须包含在“子上下文” child context 中,一些环境变量,也要同时
用于 父子上下文中,查看 SpringApplicationBuilder Javadoc 查看详情。