Martin Dvoracek
Martin Dvoracek

Reputation: 1738

Transform Spring MVC web application into a console application

I've got a Maven-based Spring MVC webapp, which structure looks like this:

project schema

After build it creates a .war and deploys it to an application server. HomeController has request mapping to some url patterns and return .jsp according to given request.

 @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. To make it easier, let's say, I've got just one view and I don't need to handle different url request patterns.

Upvotes: 1

Views: 842

Answers (1)

Master Slave
Master Slave

Reputation: 28559

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. Check http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging

Upvotes: 1

Related Questions