Spring Boot Presentation at AustinGUG

On June 12, Vasu Srinivasan spoke at the Austin Groovy and Grails User Group about Spring Boot. Here are my notes from the meeting.

Video: Battle of Software Languages
What is wrong with current Spring?
Scalability is an issue
Stateless services are better
Do we really need WebSphere for everything?
Rampup time can be pretty high to get things going

Why Spring Boot?
xml for configuration: verbose, bloated, error-prone
Many web app frameworks that started after Spring do not use XML
Ramp up time is important
Opinionated frameworks are becoming fashionable
Spring has to compete with Ratpack, DropWizard, Sinatra, Scalatra, micro-services architecture
Spring has a lot of libraries and components, it needs a way to tie them together

Opinionated:
Convention over configuration

What is it?
It’s a container project for creating new Spring projects
It comes with Tomcat or Jetty
It has a lot of starter POMs for lot of libraries:: web jdbc, log, data
It has actuators (health, metrics, beans info, etc)
It supports XML, Java annotated and Groovy bean configuration (not much doc on Groovy)
Supports many databases
Can be used for web/non-web (batch) functionality
Supports many views (jsp, thymeleaf, groovy template engine)

Tradition Spring apps usually Java, what about Groovy?
spring-cli lets you use Groovy, then spring run app.groovy
You can use Groovy as THE language:
apply plugin:’groovy’
compile(“org.codehaus.groovy:groovy:$groovyVersion”)

You can use Groovy bean instead of xml
GroovyBeanDefinitionreader, likd Grails resources.groovy
Groovy Template Engine
You can use GORM
Annotate with @Entity

Immediate advantages with Groovy
Practical and time-saving annotations: @ToString, @Log, @EqualsAndHashCode
Groovy 2.3 has fast JSON conversions
Null-safe
Groovy Strings
Spock testing
You can compile with @CompileStatic to get faster performance

Go to http://start.spring.io/ to create project

You can use logback, that is what Spring team recommends
The command is gradle bootRun
The for prod, gradle buildJar

Good, Baffling, Unexpected
REST is easy, deployment is easy
Java annotated config is good
Gradle support is good

Baffling:
So many ways to do properties
Decide early, YAML is recommended
Too many logging frameworks
No out of the box support for profiles
Lots of annotations
I mean a LOT of annotations
Many places to put views

Unexpected:
Not all xml config an be done with Groovy
No way to directly convert Grails domain objects to JSON
Some things are broke in 1.1, like Gorm

With IntelliJ, you must run in IDE, not with Gradle
Sometimes port is not released
You need to associate template files with Groovy

Nice to have: Groovy config support
Expose entities as REST entities
Maybe it’s in the works

Is it for you?
Are you using Spring?
Do you want better deployment, you want to scale

Image from “Evangelia”, an 11th century manuscript housed at the Bibliothèque nationale de France. Source gallica.bnf.fr / BnF; image assumed allowed under Fair Use.

 

There are 476 words in this article.