spring with backbone marionette

Spring with Backbone-Marionette: Hello World

We will begin to setup Java Spring framework that will be serving up our Backbone and Marionette client. See the Getting Started post a brief introduction of why we are pursuing this madness. I will be using the Spring Tool Suite for this series however the setup should be similar for Jetbrains intelliJ and webStorm or straight Eclipse with some configuration differences.

Prerequisites (OSX)

Java JDK

You will need Java installed but I will assume that you have done this already as IntelliJ, Spring Boot/Eclipse would require Java JDK to do Java development. Just in case you need to or want to upgrade your Java version you can follow these instructions.


Apache Tomcat will be used as our web server however because we will be using Spring Boot we do not need to run Tomcat to deploy our web application. Spring Boot will build these dependencies into our project and start up an embedded Apache Tomcat instance, by default to self host our project.


You can find your own way if you wish to install via Brew or Mac-ports but lets do it the fun way. Download the maven tar file from the Apache Maven website.

  • Copy the tar file to /usr/local/apache-maven
  • Extract the distribution tar -zxvf apache-maven-3.1.1-bin.tar.gz
  • The subdirectory apache-maven-3.1.1  will be created from the archive
  • Open a command terminal an edit your shell script file (your .bashrc, .zshrc, .profile etc.)
    • Add the M2_HOME variable export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1
    • Add the M2 variable export M2=$M2_HOME/bin
    • Attach M2 variable to your path   export PATH=$PATH:$M2
    • Run mvn --version  to verify that it is correctly installed.

Setup the Spring Boot Project

  • Assure Spring Tool Suite (STS) is installed and setup to use your working folder
  • In STS select File->New->Spring Starter Project
  • Configure the project.

New Spring Project

  • Select to use the Thymeleaf template engine plugin and Finish.

New Spring Project - Thymeleaf

  • Lets quickly run the newly created spring boot app
    • Select the app in the Package Explorer
    • Select Run and select Spring Boot App in the Run as dialog

Screen Shot 2015-12-08 at 4.08.07 PM

  • You will see it build in the console
  • Then browse to http://localhost:8080 and you will see a page with a “Whitelabel Error Page” because we have not set any content to host yet.


 Hosting Our Hello World String

Later on we will be hosting an actual single page web application from our Spring project but for now lets use a simple request mapping to respond to a request to the web root “/” with the words “Hello World” in the browser.

  • Create a controller in your java project that well handle any requests to the root of your hosted site in this case the root URL would be “http://localhost:8080/”.
  • Here you can see we called ours RootController

Screen Shot 2015-12-08 at 4.38.16 PM

package com.appmite.amspring.controllers;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

public class RootController {

	public String home() {
		return "Hello World";
  •  Now you can


Next: Serving up our JavaScript Single Page application