Tuesday, August 19, 2014

Spring 4 Scala MVC without Web.XML - Tiles3 with SBT Tomcat7 configuration

  In the one of previously published blogposts I've written about Spring Container running on Jetty (Scala Spring 4 MVC without Web.XML configuration with static resources,  update: Scala Spring 4 MVC without Web.XML - logging with Log4j and SLF4j)

  The next example Spring 4 Scala MVC without Web.XML with Apache Tiles3 runs on Tomcat7 using Java Servlet 3.x but before we need to configure SBT to provide us such functionality: 

1. configure project build.sbt file in following example way
libraryDependencies ++= Seq(
  "org.springframework" % "spring-webmvc" % "4.0.6.RELEASE",
  "org.springframework" % "spring-context" % "4.0.6.RELEASE",
  "org.springframework" % "spring-context-support" % "4.0.6.RELEASE",
  "org.apache.tiles" % "tiles-jsp" % "3.0.4",
  "javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided",
  "javax.servlet" % "jstl" % "1.2" % "compile",
  "org.slf4j" % "jcl-over-slf4j" % "1.7.5" ,
  "org.slf4j" % "slf4j-api" % "1.7.5" ,
  "org.slf4j" % "slf4j-log4j12" % "1.7.5",
  "log4j" % "log4j" % "1.2.17" excludeAll(
        ExclusionRule(organization = "com.sun.jdmk"),
        ExclusionRule(organization = "com.sun.jmx"),
        ExclusionRule(organization = "javax.jms")
      ),
  "org.apache.tomcat.embed"% "tomcat-embed-core"% "7.0.40"% "container",
  "org.apache.tomcat.embed"% "tomcat-embed-logging-juli"% "7.0.40"% "container",
  "org.apache.tomcat.embed"% "tomcat-embed-jasper"% "7.0.40"% "container"
)

tomcat(port = 9090)
important part is about tomcat related libraries which allow us:

2. by having running sbt such configuration makes possible to use following command 
container:start
stopping server is by exchanging word after :

Enjoy SBT Tomcat 7 development !

project: miko-spring-scala on github

No comments: