I created a spring boot application with a parent context (services) and child context (spring-webmvc controllers):
@Configuration
public class MainApiApplication {
public static void main(String[] args) {
new SpringApplicationBuilder()
.parent(Services.class)
.child(ApiOne.class, MainApiApplication.class)
.run(args);
}
@Bean
public EmbeddedServletContainerFactory servletContainer() {
return new TomcatEmbeddedServletContainerFactory();
}
}
Now I want to add another client context (and DispatcherServlet) for my ApiTwo.class
configuration. I think I have to do two things:
- Move the
servletContainer
(thus the MainApiApplication.class configuration) out of the child context and
- add a path mapping
/one/ -> ApiOne.class
and /two/ ApiTwo.class
What is the spring boot way to do it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…