Announcement Announcement Module
Collapse
No announcement yet.
Embedded Jetty example with Spring MVC Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Embedded Jetty example with Spring MVC

    Is there an example of spring MVC with an embedded jetty instance?

    I would really appreciate if someone has a working example of how to create a main class with an embedded jetty instance using Maven.

  • #2
    I created a template project that uses embedded jetty with SpringMVC.. This is one I came up with after trial and error embedding Jetty in a few different ways. I've always run into problems with JSP/JSTL. Anyways, this template started with the SpringMVC template project created by STS. It has a few additions that I always do, like logback instead of log4j, but that should matter much..

    https://github.com/jasonish/springmvc-template-jetty

    In its current form its basically a wrapper around a classic style web application. My main use for SpringMVC is bolting on a web interface to an existing application, so it will migrate that way in the next little while. Should still be useful.

    If all you really want to do is make an executable jar out of an existing war you might want to checkout the tomcat7 plugin:

    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0</version>
    <executions>
    <execution>
    <id>tomcat-run</id>
    <goals>
    <goal>exec-war-only</goal>
    </goals>
    <phase>package</phase>
    <configuration>
    <path>/</path>
    </configuration>
    </execution>
    </executions>
    </plugin>

    This will basically embed your war into jar that contains tomcat..

    Hope that helps.

    Comment


    • #3
      I make a example to redirect any request to port 8080 and redirect to a new location.
      First "mvn package" and goto target folder to run "java -jar redirector.jar".

      Comment

      Working...
      X