State of Nation § Grails 2.4.3 most recent version § Grails 2.3.x line at 2.3.9 § Hundreds of bugs fixed in the last 3 months § More than 1,100 plugins now for Grails
Spring 4.0 / 4.1 • Native GroovyBeanDefinitionReader (ported from BeanBuilder) – https://spring.io/blog/2014/03/03/groovy- bean-configuration-in-spring-framework-4 • Spring Web Socket – http://grails.org/plugin/spring-websocket 6
Standalone • GORM for Hibernate 4 in Spring Boot – https://spring.io/guides/gs/accessing-data-gorm/ • GORM for MongoDB in Spring Boot – https://spring.io/guides/gs/accessing-data-gorm-mongodb/ • GSP standalone – https://github.com/grails/grails-boot/tree/master/sample-apps/ gsp 11
Hibernate Column Readers/Writers • Implement custom column readers and writers to transform data when written or read from the database. 16 class
Name
{
String
title
static
mapping
=
{
title
write:'UPPER(?)',
read:'REPEAT(title,
2)'
}
}
GORM for MongoDB 3.0 • Support for MongoDB 2.6 • GeoJSON type support • Maps of entities • Full Text Search • Projections using Aggregations • Size queries (sizeEq, sizeLt etc.) • Spring Boot – https://spring.io/guides/gs/accessing- data-gorm-mongodb/ 18
New Maven Plugin 2.4.3 • Upgraded to Maven 3.1+ • Rewritten to use Aether for dependency resolution as per recommendations • Can now be used with multiple versions of Grails: 19
Spring IO & Grails • What does Spring IO bring to Grails? – Standardised dependency management – Published BOMs for use with Maven & Gradle – Foundational libraries – See more http://docs.spring.io/platform/docs/current/ reference/htmlsingle/ 27 dependencies
{
compile
'commons-‐lang:commons-‐lang'
}
Gradle • Deprecate existing build system • Replace with Gradle build • Easier now everything is forked in 2.3.x • All the flexibility of a powerful build system • Separate build plugins can provide Gradle extensions 28
Spring Boot • Grails 3.0 to be built on Spring Boot • Boot to handle • Embedded servers • Runnable JARs • WAR packaging • Scripting / Micro Services 32
Why Spring Boot? • Handles Fat JAR and embedding • Already supports different runtimes • Includes monitoring and health checks • Grails can take advantage of Boot auto configuration 33
Deprecations / Removals • Servlet 2.5 support (no web.xml) • Gant & Current Build System • GDoc - Replaced by AsciiDoctor • Integration Tests - Replaced by more Mixins • Converters / Codecs plugins - Replaced by Groovy extensions • Filters - Replaced by new mechanism 36
Servlet 3.0 only and no web.xml • Thanks to Spring Boot, new servlets and filters can just be Spring beans 37 ! def
doWithSpring
=
{
characterEncodingFilter(
CharacterEncodingFilter)
{
encoding
='utf-‐8'
}
}
Benefits of Simplification • Less code to maintain • Better performance • Better integration with Spring • Fewer dependencies • commons-fileupload gone • No internal forwarding 41
Grails 3.0 & Groovy Traits • Most logic previously added via AST transforms will now be added by Traits – (Cases not possible as Trait done with transforms) 43 trait
Controller
{
…
def
withFormat(Closure
callable)
{
…
}
}
Application Profiles • Extensible profiles with an API exposing structure • Profile specific commands (run, package, test) • Profile specific plugins • Profile specific project templates and file templates (code generators) backed by Git • Community maintained profiles and core profiles 45