SlideShare a Scribd company logo
1 of 43
Download to read offline
What’s new in 2.0
     Peter Ledbrook
     SpringSource




     t: @pledbrook
     g: +PeterLedbrook
     e: pledbrook@vmware.com




Wednesday, 2 May 12
The Year in Grails

     • Grails 1.3
       –Plugins in Dependency DSL, Groovy 1.7, Named
        Queries etc.
     • More and more plugins
       –Spring Security Core et al.
       –RabbitMQ
       –Gemfire
       –Resources, etc.
     • NoSQL
       –Redis, MongoDB, Riak, etc.


                                                       2

Wednesday, 2 May 12
High Profile Sites




                          3

Wednesday, 2 May 12
Grails Continued Growth


                 Number of Plugins
800

600

400

200

      0
       2008           2009   2010    2011


                                            4

Wednesday, 2 May 12
Development Environment Features




Wednesday, 2 May 12
New Console UI & Interactive Mode




                                         6

Wednesday, 2 May 12
Better Unit Test Template




                                 7

Wednesday, 2 May 12
Better Documentation Template




                                     8

Wednesday, 2 May 12
Enhanced Error Reporting




                                9

Wednesday, 2 May 12
H2 Console

     • Available at http://localhost:8080/app/dbconsole in
       development only!




                                                             10

Wednesday, 2 May 12
Plugin Portal Usage Tracking

     • Opt-in usage tracking of plugins




                                          11

Wednesday, 2 May 12
Upgraded Libraries




                          12

Wednesday, 2 May 12
New Automatic Reloading

     • Reloading in run-app works with
          – Typed service references
          – Domain classes
          – src/groovy, src/java
     • Any command with -reloading
     • Interactive mode and integration tests




                                                13

Wednesday, 2 May 12
Binary Plugins

     •   Package pre-compiled plugins into JAR files
     •   Deployable as standard JARs to Maven repositories
     •   Declared as JAR dependencies
     •   Commercial plugins more viable
     •   No special IDE integration needed


                      $ grails package-plugin --binary




                                                             14

Wednesday, 2 May 12
Web Features




Wednesday, 2 May 12
Methods as Actions and Binding Arguments

     • Actions are now declared as public methods
      def save(String name, int age) {
          // remaining
      }

     • Form parameters bound to method arguments

      <g:form name="myForm" action="save">
          <input name="name" />
          <input name="age" />
      </g:form>


                                                    16

Wednesday, 2 May 12
HTML5 Scaffolding




                         17

Wednesday, 2 May 12
New APIs

     • Page Rendering
      PageRenderer renderer
      void welcomeUser(User user) {
          def contents = renderer.render(view:"/emails/welcome",
                                         model:[user: user])
          ...
      }
     • Link Generation

     LinkGenerator generator
     def generateLink() {
         generator.link(controller:"book", action:"list")
     }




                                                               18

Wednesday, 2 May 12
Servlet 3.0 Async

     • Servlet 3.0 async API supported for async response
       rendering
      def index() {
          def ctx = startAsync()
          ctx.start {
              new Book(title:"The Stand").save()
              render template:"books",
                      model:[books: Book.list() ]
              ctx.complete()
          }
      }


                                                            19

Wednesday, 2 May 12
Advanced Static Resource Handling

     • Integrated resource plugin into core
          – http://grails.org/plugin/resources
     • Tuning static resources no longer a headache
          – gzip (http://grails.org/plugin/zipped-resources)
          – cache (http://grails.org/plugin/cached-resources)
          – de-duplication
          – bundling
     • New tags to ease integration
          – img
          – external
          – javascript

                                                                20

Wednesday, 2 May 12
Bundling Static Resources

     modules = {
         core {
            dependsOn 'utils'
            resource url:'/js/core.js', disposition: 'head'
            resource url:'/js/ui.js'
            resource url:'/css/main.css',
            resource url:'/css/branding.css'
            resource url:'/css/print.css', attrs:[media:'print']
         }
         utils {
             dependsOn 'jquery'
             resource url:'/js/utils.js'
         }
     }




                                                              21

Wednesday, 2 May 12
Zipping and Caching




      $ grails install-plugin cached-resources

      $ grails install-plugin zipped-resources




                                                 22

Wednesday, 2 May 12
Other Web Novelties

     • jQuery now the default
     • Easy Date Parsing
      def val =
          params.date('myDate', 'dd-MM-yyyy')

     • Customizable URL formats
     • Filter exclusions




                                                23

Wednesday, 2 May 12
Persistence Features




Wednesday, 2 May 12
GORM API




     • Plugins should not assume Hibernate!

                                              25

Wednesday, 2 May 12
GORM Plugins

     •   Redis - http://grails.org/plugin/redis-gorm
     •   MongoDB - http://grails.org/plugin/mongodb
     •   Amazon SimpleDB - http://grails.org/plugin/simpledb
     •   Amazon DynamoDB - http://grails.org/plugin/dynamodb
     •   Neo4j - http://grails.org/plugin/neo4j
     •   Riak - http://grails.org/plugin/riak
     •   GORM JPA - http://grails.org/plugin/gorm-jpa
     •   Hibernate - http://grails.org/plugin/hibernate




                                                           26

Wednesday, 2 May 12
Where Queries

     • New, compile-time checked query DSL
             def query = Person.where {
                firstName == "Bart"
             }
             Person bart = query.find()

     • Uses native Groovy operators ==, !=, >, <, <=, >= etc
             def query = Person.where {
                firstName == "Fred" && !(lastName == 'Simpson')
             }
     • Aggregate functions supported avg, sum, max, min etc.
             def query = Person.where {
               age > avg(age)
             }


                                                                  27

Wednesday, 2 May 12
Multiple Data Sources

     • Support for defining multiple scoped data sources
             class ZipCode {
                String code
                static mapping = {
                   datasource 'auditing'
                }
             }


     • Each data source accessible via static property

             def zipCode = ZipCode.auditing.get(42)




                                                           28

Wednesday, 2 May 12
SQL Database Migration


                      Hibernate ‘update’
                              +
                       Production data
                              =

                              ?


                                           29

Wednesday, 2 May 12
SQL Database Migration

     • Install the Database Migration plugin:


          $ grails install-plugin database-migration


     • Official Docs at:
          – http://grails-plugins.github.com/grails-database-migration/




                                                                     30

Wednesday, 2 May 12
SQL Database Migration

                      Pre-production, Hibernate ‘update’ or ‘create-drop’



                                   dbm-generate-changelog
                                     dbm-changelog-sync



                                   Change domain model



                                        dbm-gorm-diff
                                         dbm-update


                                                                            31

Wednesday, 2 May 12
SQL Reverse Engineering

          $ grails install-plugin db-reverse-engineer
          $ grails db-reverse-engineer



                                     class Person {
                                         String name
                                         Integer age
                                         ...
                                     }




                                                        32

Wednesday, 2 May 12
Other GORM Improvements

     • Abstract base domain classes
          – These now result in a table
     • findOrCreateWhere()
     • findOrSaveWhere()
      def user = User.findByLogin('admin')
      if (!user) {
          user = new User(login: 'admin')
          user.save(failOnError: true)
      }

      def user = User.findOrSaveWhere(login: 'admin')

                                                       33

Wednesday, 2 May 12
Better Unit Testing




Wednesday, 2 May 12
Unit Testing 1.x

     • mockDomain() had only partial GORM support
          – always lagged changes in GORM
     • Inheritance-based
          – hierarchy duplicated for Spock
          – difficult to extend
     • Weak support for web-related testing
          – controllers
          – tag libraries




                                                    35

Wednesday, 2 May 12
The Mixin Approach


     @TestFor(MyController)
     @Mock(Person)
     class MyControllerUnitTests {
         void setUp() {
                      new Person(...).save()
                      new Person(...).save()
               }

               void testIndex() {
                   def model = this.controller.index()
                   ...
               }
     }




                                                         36

Wednesday, 2 May 12
Spockified

     @TestFor(MyController)
     @Mock(Person)
     class MyControllerUnitSpec extends Specification {
         void loadPeople() {
                      new Person(...).save()
                      new Person(...).save()
               }

               def 'Test index action'() {
                   given: 'Some people'
                       loadPeople()
                   when: 'The index action is called'
                      def model = this.controller.index()
                   then: 'The people variable is in the model'
                      model.people != null
               }
     }


                                                                 37

Wednesday, 2 May 12
In-Memory GORM

     • Full GORM implementation against ConcurrentHashMap
     • Based on GORM for NoSQL codebase
     • Support for
          – Criteria queries
          – Where queries
          – Dynamic finders
          – Detached criteria




                                                       38

Wednesday, 2 May 12
Support for testing...

     •   Tag libraries
     •   Command objects
     •   XML & JSON responses
     •   File upload
     •   View and template rendering
     •   Filters
     •   URL mappings
     •   Criteria queries
     •   and more!



                                       39

Wednesday, 2 May 12
Contributions

     •   110+ pull requests on grails-core
     •   60+ pull requests on grails-docs
     •   More and more plugins
     •   GitHub for the win!
          – grails-core
          – grails-docs
          – grails-website
          – grails-maven
          – and many, many plugins




                                             40

Wednesday, 2 May 12
Grails in the Cloud




                           41

Wednesday, 2 May 12
Roadmap




                      42

Wednesday, 2 May 12
Thank you!

                       Questions?




                                    43

Wednesday, 2 May 12

More Related Content

What's hot

Architecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentationArchitecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentationVlad Ponomarev
 
Protect your app from Outages
Protect your app from OutagesProtect your app from Outages
Protect your app from OutagesRon Zavner
 
Hong Qiangning in QConBeijing
Hong Qiangning in QConBeijingHong Qiangning in QConBeijing
Hong Qiangning in QConBeijingshen liu
 
Clustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix
 
Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...
Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...
Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...DataStax Academy
 
Apache Cassandra and Drivers
Apache Cassandra and DriversApache Cassandra and Drivers
Apache Cassandra and DriversDataStax Academy
 
Document validation in MongoDB 3.2
Document validation in MongoDB 3.2Document validation in MongoDB 3.2
Document validation in MongoDB 3.2Andrew Morgan
 
Python-CouchDB Training at PyCon PL 2012
Python-CouchDB Training at PyCon PL 2012Python-CouchDB Training at PyCon PL 2012
Python-CouchDB Training at PyCon PL 2012Stefan Kögl
 
NoSQL on microsoft azure april 2014
NoSQL on microsoft azure   april 2014NoSQL on microsoft azure   april 2014
NoSQL on microsoft azure april 2014Brian Benz
 
Kharkivpy#3: Javascript and Python backend
Kharkivpy#3: Javascript and Python backendKharkivpy#3: Javascript and Python backend
Kharkivpy#3: Javascript and Python backendMax Klymyshyn
 
MongoDB Best Practices for Developers
MongoDB Best Practices for DevelopersMongoDB Best Practices for Developers
MongoDB Best Practices for DevelopersMoshe Kaplan
 
MongoDB ClickStream and Visualization
MongoDB ClickStream and VisualizationMongoDB ClickStream and Visualization
MongoDB ClickStream and VisualizationCameron Sim
 
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...MongoDB
 
What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?Nuxeo
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingDataStax Academy
 
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenBuilding Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenOliver Ochs
 

What's hot (19)

Hadoop 101
Hadoop 101Hadoop 101
Hadoop 101
 
Architecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentationArchitecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentation
 
Protect your app from Outages
Protect your app from OutagesProtect your app from Outages
Protect your app from Outages
 
Hong Qiangning in QConBeijing
Hong Qiangning in QConBeijingHong Qiangning in QConBeijing
Hong Qiangning in QConBeijing
 
Clustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmark
 
CQL3 in depth
CQL3 in depthCQL3 in depth
CQL3 in depth
 
Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...
Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...
Cassandra Day Atlanta 2015: Building Your First Application with Apache Cassa...
 
Apache Cassandra and Drivers
Apache Cassandra and DriversApache Cassandra and Drivers
Apache Cassandra and Drivers
 
Document validation in MongoDB 3.2
Document validation in MongoDB 3.2Document validation in MongoDB 3.2
Document validation in MongoDB 3.2
 
Python-CouchDB Training at PyCon PL 2012
Python-CouchDB Training at PyCon PL 2012Python-CouchDB Training at PyCon PL 2012
Python-CouchDB Training at PyCon PL 2012
 
NoSQL on microsoft azure april 2014
NoSQL on microsoft azure   april 2014NoSQL on microsoft azure   april 2014
NoSQL on microsoft azure april 2014
 
Kharkivpy#3: Javascript and Python backend
Kharkivpy#3: Javascript and Python backendKharkivpy#3: Javascript and Python backend
Kharkivpy#3: Javascript and Python backend
 
CouchDB
CouchDBCouchDB
CouchDB
 
MongoDB Best Practices for Developers
MongoDB Best Practices for DevelopersMongoDB Best Practices for Developers
MongoDB Best Practices for Developers
 
MongoDB ClickStream and Visualization
MongoDB ClickStream and VisualizationMongoDB ClickStream and Visualization
MongoDB ClickStream and Visualization
 
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
Lightning Talk: Why and How to Integrate MongoDB and NoSQL into Hadoop Big Da...
 
What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data Modeling
 
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenBuilding Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
 

Similar to Grails 2.0 Update

Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013Matt Raible
 
Offline first development - Glasgow PHP - January 2016
Offline first development - Glasgow PHP - January 2016Offline first development - Glasgow PHP - January 2016
Offline first development - Glasgow PHP - January 2016Glynn Bird
 
MongoDB Use Cases and Roadmap
MongoDB Use Cases and RoadmapMongoDB Use Cases and Roadmap
MongoDB Use Cases and RoadmapMongoDB
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Matt Raible
 
springdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdfspringdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdfssuser0562f1
 
Architecting non-trivial browser applications (Jazoon 2012)
Architecting non-trivial browser applications (Jazoon 2012)Architecting non-trivial browser applications (Jazoon 2012)
Architecting non-trivial browser applications (Jazoon 2012)Marc Bächinger
 
Russell 2012 introduction to spring integration and spring batch
Russell 2012   introduction to spring integration and spring batchRussell 2012   introduction to spring integration and spring batch
Russell 2012 introduction to spring integration and spring batchGaryPRussell
 
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019Codemotion
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalystsvilen.ivanov
 
A Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapA Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapMongoDB
 
PuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That WasPuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That WasWalter Heck
 
PuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That WasPuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That WasOlinData
 
Atlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring IntegrationAtlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring IntegrationGunnar Hillert
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin WritingSchalk Cronjé
 
2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_new2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_newMongoDB
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmapHerman Duarte
 

Similar to Grails 2.0 Update (20)

Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
 
Gradle
GradleGradle
Gradle
 
Offline first development - Glasgow PHP - January 2016
Offline first development - Glasgow PHP - January 2016Offline first development - Glasgow PHP - January 2016
Offline first development - Glasgow PHP - January 2016
 
MongoDB Use Cases and Roadmap
MongoDB Use Cases and RoadmapMongoDB Use Cases and Roadmap
MongoDB Use Cases and Roadmap
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
 
springdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdfspringdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdf
 
Architecting non-trivial browser applications (Jazoon 2012)
Architecting non-trivial browser applications (Jazoon 2012)Architecting non-trivial browser applications (Jazoon 2012)
Architecting non-trivial browser applications (Jazoon 2012)
 
Russell 2012 introduction to spring integration and spring batch
Russell 2012   introduction to spring integration and spring batchRussell 2012   introduction to spring integration and spring batch
Russell 2012 introduction to spring integration and spring batch
 
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
 
Gradle ex-machina
Gradle ex-machinaGradle ex-machina
Gradle ex-machina
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
A Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and RoadmapA Morning with MongoDB Barcelona: Use Cases and Roadmap
A Morning with MongoDB Barcelona: Use Cases and Roadmap
 
PuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That WasPuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
 
PuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That WasPuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
PuppetCamp SEA @ Blk 71 - Puppet: The Year That Was
 
Atlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring IntegrationAtlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring Integration
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin Writing
 
2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_new2012 mongo db_bangalore_roadmap_new
2012 mongo db_bangalore_roadmap_new
 
Resources plugin
Resources pluginResources plugin
Resources plugin
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmap
 

More from Peter Ledbrook

Improving your Gradle builds
Improving your Gradle buildsImproving your Gradle builds
Improving your Gradle buildsPeter Ledbrook
 
Why your build matters
Why your build mattersWhy your build matters
Why your build mattersPeter Ledbrook
 
Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java DevelopersPeter Ledbrook
 
Application Architectures in Grails
Application Architectures in GrailsApplication Architectures in Grails
Application Architectures in GrailsPeter Ledbrook
 
Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013Peter Ledbrook
 
Groovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersGroovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersPeter Ledbrook
 
Grails & the World of Tomorrow
Grails & the World of TomorrowGrails & the World of Tomorrow
Grails & the World of TomorrowPeter Ledbrook
 
Migrating to Cloud Foundry
Migrating to Cloud FoundryMigrating to Cloud Foundry
Migrating to Cloud FoundryPeter Ledbrook
 
Grails and the World of Tomorrow
Grails and the World of TomorrowGrails and the World of Tomorrow
Grails and the World of TomorrowPeter Ledbrook
 
Cloud Foundry for Java devs
Cloud Foundry for Java devsCloud Foundry for Java devs
Cloud Foundry for Java devsPeter Ledbrook
 

More from Peter Ledbrook (11)

Why Gradle?
Why Gradle?Why Gradle?
Why Gradle?
 
Improving your Gradle builds
Improving your Gradle buildsImproving your Gradle builds
Improving your Gradle builds
 
Why your build matters
Why your build mattersWhy your build matters
Why your build matters
 
Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java Developers
 
Application Architectures in Grails
Application Architectures in GrailsApplication Architectures in Grails
Application Architectures in Grails
 
Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013
 
Groovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersGroovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developers
 
Grails & the World of Tomorrow
Grails & the World of TomorrowGrails & the World of Tomorrow
Grails & the World of Tomorrow
 
Migrating to Cloud Foundry
Migrating to Cloud FoundryMigrating to Cloud Foundry
Migrating to Cloud Foundry
 
Grails and the World of Tomorrow
Grails and the World of TomorrowGrails and the World of Tomorrow
Grails and the World of Tomorrow
 
Cloud Foundry for Java devs
Cloud Foundry for Java devsCloud Foundry for Java devs
Cloud Foundry for Java devs
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Grails 2.0 Update

  • 1. What’s new in 2.0 Peter Ledbrook SpringSource t: @pledbrook g: +PeterLedbrook e: pledbrook@vmware.com Wednesday, 2 May 12
  • 2. The Year in Grails • Grails 1.3 –Plugins in Dependency DSL, Groovy 1.7, Named Queries etc. • More and more plugins –Spring Security Core et al. –RabbitMQ –Gemfire –Resources, etc. • NoSQL –Redis, MongoDB, Riak, etc. 2 Wednesday, 2 May 12
  • 3. High Profile Sites 3 Wednesday, 2 May 12
  • 4. Grails Continued Growth Number of Plugins 800 600 400 200 0 2008 2009 2010 2011 4 Wednesday, 2 May 12
  • 6. New Console UI & Interactive Mode 6 Wednesday, 2 May 12
  • 7. Better Unit Test Template 7 Wednesday, 2 May 12
  • 8. Better Documentation Template 8 Wednesday, 2 May 12
  • 9. Enhanced Error Reporting 9 Wednesday, 2 May 12
  • 10. H2 Console • Available at http://localhost:8080/app/dbconsole in development only! 10 Wednesday, 2 May 12
  • 11. Plugin Portal Usage Tracking • Opt-in usage tracking of plugins 11 Wednesday, 2 May 12
  • 12. Upgraded Libraries 12 Wednesday, 2 May 12
  • 13. New Automatic Reloading • Reloading in run-app works with – Typed service references – Domain classes – src/groovy, src/java • Any command with -reloading • Interactive mode and integration tests 13 Wednesday, 2 May 12
  • 14. Binary Plugins • Package pre-compiled plugins into JAR files • Deployable as standard JARs to Maven repositories • Declared as JAR dependencies • Commercial plugins more viable • No special IDE integration needed $ grails package-plugin --binary 14 Wednesday, 2 May 12
  • 16. Methods as Actions and Binding Arguments • Actions are now declared as public methods def save(String name, int age) { // remaining } • Form parameters bound to method arguments <g:form name="myForm" action="save"> <input name="name" /> <input name="age" /> </g:form> 16 Wednesday, 2 May 12
  • 17. HTML5 Scaffolding 17 Wednesday, 2 May 12
  • 18. New APIs • Page Rendering PageRenderer renderer void welcomeUser(User user) { def contents = renderer.render(view:"/emails/welcome", model:[user: user]) ... } • Link Generation LinkGenerator generator def generateLink() { generator.link(controller:"book", action:"list") } 18 Wednesday, 2 May 12
  • 19. Servlet 3.0 Async • Servlet 3.0 async API supported for async response rendering def index() { def ctx = startAsync() ctx.start { new Book(title:"The Stand").save() render template:"books", model:[books: Book.list() ] ctx.complete() } } 19 Wednesday, 2 May 12
  • 20. Advanced Static Resource Handling • Integrated resource plugin into core – http://grails.org/plugin/resources • Tuning static resources no longer a headache – gzip (http://grails.org/plugin/zipped-resources) – cache (http://grails.org/plugin/cached-resources) – de-duplication – bundling • New tags to ease integration – img – external – javascript 20 Wednesday, 2 May 12
  • 21. Bundling Static Resources modules = { core { dependsOn 'utils' resource url:'/js/core.js', disposition: 'head' resource url:'/js/ui.js' resource url:'/css/main.css', resource url:'/css/branding.css' resource url:'/css/print.css', attrs:[media:'print'] } utils { dependsOn 'jquery' resource url:'/js/utils.js' } } 21 Wednesday, 2 May 12
  • 22. Zipping and Caching $ grails install-plugin cached-resources $ grails install-plugin zipped-resources 22 Wednesday, 2 May 12
  • 23. Other Web Novelties • jQuery now the default • Easy Date Parsing def val = params.date('myDate', 'dd-MM-yyyy') • Customizable URL formats • Filter exclusions 23 Wednesday, 2 May 12
  • 25. GORM API • Plugins should not assume Hibernate! 25 Wednesday, 2 May 12
  • 26. GORM Plugins • Redis - http://grails.org/plugin/redis-gorm • MongoDB - http://grails.org/plugin/mongodb • Amazon SimpleDB - http://grails.org/plugin/simpledb • Amazon DynamoDB - http://grails.org/plugin/dynamodb • Neo4j - http://grails.org/plugin/neo4j • Riak - http://grails.org/plugin/riak • GORM JPA - http://grails.org/plugin/gorm-jpa • Hibernate - http://grails.org/plugin/hibernate 26 Wednesday, 2 May 12
  • 27. Where Queries • New, compile-time checked query DSL def query = Person.where { firstName == "Bart" } Person bart = query.find() • Uses native Groovy operators ==, !=, >, <, <=, >= etc def query = Person.where { firstName == "Fred" && !(lastName == 'Simpson') } • Aggregate functions supported avg, sum, max, min etc. def query = Person.where { age > avg(age) } 27 Wednesday, 2 May 12
  • 28. Multiple Data Sources • Support for defining multiple scoped data sources class ZipCode { String code static mapping = { datasource 'auditing' } } • Each data source accessible via static property def zipCode = ZipCode.auditing.get(42) 28 Wednesday, 2 May 12
  • 29. SQL Database Migration Hibernate ‘update’ + Production data = ? 29 Wednesday, 2 May 12
  • 30. SQL Database Migration • Install the Database Migration plugin: $ grails install-plugin database-migration • Official Docs at: – http://grails-plugins.github.com/grails-database-migration/ 30 Wednesday, 2 May 12
  • 31. SQL Database Migration Pre-production, Hibernate ‘update’ or ‘create-drop’ dbm-generate-changelog dbm-changelog-sync Change domain model dbm-gorm-diff dbm-update 31 Wednesday, 2 May 12
  • 32. SQL Reverse Engineering $ grails install-plugin db-reverse-engineer $ grails db-reverse-engineer class Person { String name Integer age ... } 32 Wednesday, 2 May 12
  • 33. Other GORM Improvements • Abstract base domain classes – These now result in a table • findOrCreateWhere() • findOrSaveWhere() def user = User.findByLogin('admin') if (!user) { user = new User(login: 'admin') user.save(failOnError: true) } def user = User.findOrSaveWhere(login: 'admin') 33 Wednesday, 2 May 12
  • 35. Unit Testing 1.x • mockDomain() had only partial GORM support – always lagged changes in GORM • Inheritance-based – hierarchy duplicated for Spock – difficult to extend • Weak support for web-related testing – controllers – tag libraries 35 Wednesday, 2 May 12
  • 36. The Mixin Approach @TestFor(MyController) @Mock(Person) class MyControllerUnitTests { void setUp() { new Person(...).save() new Person(...).save() } void testIndex() { def model = this.controller.index() ... } } 36 Wednesday, 2 May 12
  • 37. Spockified @TestFor(MyController) @Mock(Person) class MyControllerUnitSpec extends Specification { void loadPeople() { new Person(...).save() new Person(...).save() } def 'Test index action'() { given: 'Some people' loadPeople() when: 'The index action is called' def model = this.controller.index() then: 'The people variable is in the model' model.people != null } } 37 Wednesday, 2 May 12
  • 38. In-Memory GORM • Full GORM implementation against ConcurrentHashMap • Based on GORM for NoSQL codebase • Support for – Criteria queries – Where queries – Dynamic finders – Detached criteria 38 Wednesday, 2 May 12
  • 39. Support for testing... • Tag libraries • Command objects • XML & JSON responses • File upload • View and template rendering • Filters • URL mappings • Criteria queries • and more! 39 Wednesday, 2 May 12
  • 40. Contributions • 110+ pull requests on grails-core • 60+ pull requests on grails-docs • More and more plugins • GitHub for the win! – grails-core – grails-docs – grails-website – grails-maven – and many, many plugins 40 Wednesday, 2 May 12
  • 41. Grails in the Cloud 41 Wednesday, 2 May 12
  • 42. Roadmap 42 Wednesday, 2 May 12
  • 43. Thank you! Questions? 43 Wednesday, 2 May 12