[英]Transform Spring MVC web application into a console application
I've got a Maven-based
Spring MVC
webapp
, which structure looks like this: 我有一个
Maven-based
Spring MVC
webapp
,其结构如下所示:
After build it creates a .war
and deploys it to an application server
. 构建后,它将创建一个
.war
并将其部署到application server
。 HomeController
has request mapping to some url patterns and return .jsp
according to given request. HomeController
具有映射到某些url模式的请求,并根据给定的请求返回.jsp
。
@RequestMapping(value = "/", method = {RequestMethod.GET, RequestMethod.HEAD})
public String homeGET(Model model) {
// perform some actions
return homeView;
}
I'd need to find the smoothest way, how to transform this, into a console
.jar
application. 我需要找到最平滑的方法,如何将其转换为
console
.jar
应用程序。 To make it easier, let's say, I've got just one view and I don't need to handle different url request patterns. 为了简化起见,假设我只有一个视图,并且不需要处理不同的url请求模式。
The eaisest way to go is to port the project and base it on spring-boot, which ofters packaging as a war or an executable jar as a simple config option. 最简便的方法是移植项目并将其基于spring-boot,后者将打包成war或将可执行jar打包成简单的config选项。 Check http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging
检查http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.