【发布时间】:2016-01-19 06:16:51
【问题描述】:
我有一个运行良好的 Spring Boot restlet 应用程序,它目前是一个独立的可执行文件,启动代码不多:
@SpringBootApplication
@EnableJpaRepositories(basePackageClasses = { MelonRepository.class })
@EnableTransactionManagement
public class Runner {
public static void main(String[] args) {
SpringApplication.run(Runner.class, args);
}
}
我也有一些看起来像的restlets
@RestController
@RequestMapping(value = "/here", produces = "application/json")
public class TheController {
@Autowired
protected Business processor;
@RequestMapping(value = "/{accoId}")
public Something findSomethingByAccoId(@PathVariable String id) {
(...)
目前我没有自己的 XML,一切都是使用注解配置的。
然而,虽然该应用程序可以很好地独立运行,但我需要使其成为旧版 .war 应用程序的一部分,以便可以使用共享 web.xml 中的其他(旧版)servlet 进行配置(已经存在)。
如何将 Spring Boot restlet 包装成一个“普通”的 servlet,以便与其他“普通”的 servlet 一起部署?
【问题讨论】:
-
使用独立的 Spring MVC 和一个简单的
WebApplicationInitializer来配置你的应用程序。
标签: java spring servlets web.xml legacy