Spring-Boot adventures

Spring Boot is the last Smart micro-service offered by the big Spring. This post series will try to explain how to go with such framework to publish a small blog application to Heroku with a minimalist but usefull guide.


We want an angularjs based front-end, and a Spring-boot backend, providing some basic internal metrics about JVM and Business metrics.


So build a front app with the famous yeoman.io:

$> yo angular myApp

Then after some judicious choice, you would get a nice ready-to-use angularjs application.

You would have to add a service for post management, and a home controller:

$> yo angular:controller Post
$> yo angular:service Post


The backend will be provided trhough a small maven project, see quick-start for details.

But what you need to know is all in the pom.xml file:


With such dependencies, your project is now a simple Spring-Boot ready to run application.

Now add a simple class:

package com.webcontext.apps.demo.dablog;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

public class SampleController {

    String home() {
        return "Hello World!";

    public static void main(String[] args) throws Exception {
        SpringApplication.run(SampleController.class, args);

An now try to run it with the following command:

$ mvn spring-boot:run

and access the http://localhost:9000/


Sources are stored on my own github.com


Les commentaires sont fermés.

Créez un site Web ou un blog gratuitement sur WordPress.com.

Retour en haut ↑

%d blogueurs aiment cette page :