Notes From Austin JUG 2014-05-27

Here are the notes that I took at the May 27, 2014 meeting of the Austin JUG. There was only one presentation: Craig Walls on Spring Boot. He used quite a bit of Groovy during this presentation. You can find Craig Walls on Twitter and Github.

As always, the notes are presented pretty much as I wrote them.

Criticism of Spring: Lots of config
He says that Boot is “how we do Spring in 2014”
He goes over the evolution of Spring configuration.
Now you can make an app with no configuration.
Spring 4 can use Ruby config. Can I use Groovy?

Spring 4:
Takes away  boilerplate configuration
Heavily opinionated
Can run with Groovy at the command line
Can build to JAR or WAR

Spring Boot CLI: run Groovy apps from command line
Starts embedded Tomcat or Jetty
Heavily employs Spring Boot autoconfig

Auto-config:
creates beans as needed,
resolves beans as needed (CLI)
adds imports (CLI)

Starters:
Pre-baked POM files
Add a dependency in Maven or Gradle
Makes dependencies available

The Actuator:
Reasonable error pages
Endpoints for runtime metrics and info:
/beans: all beans
/env: Configuration properties
/trace: recent requests
/dump: thread details
/metrics: application metrics, gauge tells you how long it took for each request
/autoconfig: auto-configuration explanation
/info: by default has little, look it up. You can put something here
/health: this gives a few indicators, that your DB and services you call are running

Demo:
He installed CLI
rest_hi returns “hi”

@RestController
class App {
    @RequestMapping("/")
    String hi() {
        "Hi!"
    }
}

spring run app.groovy

That could be a tweet
Spring’s website is using Spring Boot
This could be good for Groovy

Now JSON:

@RestController
class App {
    @RequestMapping("/")
    Greeting home() {
        new Greeting(message: "Hi", place: "Austin")
    }
}
class Greeting {
    String message
    String place
}

Spring will add the imports to Groovy compiler
He will use Thymeleaf (sp?) for UI
He will use H2 database

There is a Gradle spring-boot plugin

It would be great if the guy behind me would stop yawning

Spring Tool Suite has Boot Support

To secure actuators: Add Spring Security starter to your classpath
default: user/password

You can put stuff in application.properties or application.yaml
Go to Spring.io
Look at the Getting Started Guides, most of them use Spring Boot
Spring Boot requires Spring 4.0

 

Image from “Grec 48 EUSEBIUS Cæsariensis. Auteur du texte”, a 9th century manuscript housed at the Bibliothèque nationale de France. Source gallica.bnf.fr / BnF; image assumed allowed under Fair Use.