Grails Anti-Pattern: Everything is a Service

The context Grails makes it very easy to put any logic of your application in a service. Just grails create-service and you’re good to go. There’s a single instance by default, injectable anywhere. Powerful stuff and makes it easy to get up ’n running very fast! Creating a new application, following so-called “best practices” from blogs like these 🙂 and … Lees verder Grails Anti-Pattern: Everything is a Service

Grails Anti-Pattern: Locally Optimized Dynamic Finders Everywhere

The context Grails makes it very easy to persist and find stuff using domain classes. It uses GORM (Grails’ Object Relational Mapping) under the hood, which by default uses Hibernate to map domain classes to tables in a database. Powerful stuff and makes it easy to get up ’n running very fast! Creating a new application, following so-called “best practices” … Lees verder Grails Anti-Pattern: Locally Optimized Dynamic Finders Everywhere

Eclipse Neon: Grails 2.x with Groovy and GSP Support

What if you want to develop Grails 2 projects with Eclipse Neon (4.6) as easy as you did with Groovy/Grails Tool Suite? Written and tested with Eclipse Neon and Grails 2.3, 2.4 and 2.5. Disclaimer: this post is a complete copy of my awesome colleague Ted Vinke’s post about eclipse Mars of last year! Actually, this is of course only … Lees verder Eclipse Neon: Grails 2.x with Groovy and GSP Support

So If You’re Using Tag Libraries for Your View Models You Have To Test Them, Right?

In a previous post I introduced thinking about (visual) components and used a Task Browser as an example of an user interface “component” . I explained that using View Model(s) e.g. plain-old Groovy objects (POGOs) holding the related data e.g. a class TaskBrowser Tag Libraries (LayoutTagLib) and tags (def taskBrowser) to render the associated HTML (views/layouts/components/_taskBrowser.gsp) to the page allows for … Lees verder So If You’re Using Tag Libraries for Your View Models You Have To Test Them, Right?

Why Grails logs package names in different ways

I just realized something that had me puzzled for some time. For some reason, Grails logging for a specific component or class stopped or started ‘working’ at some point in time. I never got around to looking into it much, though the idea of not knowing why this happened was uncomfortable. TLDR: Not all loggers are created equal Grails’ implicit … Lees verder Why Grails logs package names in different ways

Grails Design Consideration #2 – Throw In a View Model Once In a While

This is my take on how we could design our particular user interface in such a way that they’re re-usable, testable and the overall software is more maintainable. Yip, using a bit of View Models from the MVVM pattern. Background Recently we started working with two teams on a new Grails application. As part of that I reviewed some code … Lees verder Grails Design Consideration #2 – Throw In a View Model Once In a While

Grails 3.1 Released

Many milestone builds and release candidates later, the official Grails 3.1 shipped a few days ago!

OCI, the new Grails home, summarizes what’s new in this release:

  • Grails 3.1 comes with Spring Boot 1.3 and Spring 4.2, enabling you to produce runnable JAR files that embed Tomcat, Jetty or other containers. In addition you can use Spring Cloud with Grails 3.1 to build Cloud Native applications.
  • Grails 3.1 features new support for expandable application profiles, allowing developers to build application creation templates that target a range of different tasks.
  • Grails 3.1 features new profiles for building REST applications and Single Page Applications (SPA) using AngularJS. The REST profile features a focused environment that helps developers quickly spin-up REST servers, easily deployable either standalone or to modern Java application servers.
  • The new AngularJS profile in Grails 3.1 helps developers quickly become productive building Single Page Applications (SPA) using AngularJS. By integrating seamlessly with tools such as Bower and Karma, the AngularJS profile provides everything you need to build, run and deploy AngularJS applications backed by Grails.
  • Grails 3.1 comes with GORM 5, a ground-up rewrite of the innovative data access framework that comes with Grails. Featuring new support for the graph database Neo4j, as well as enhanced support for MongoDB 3 and Hibernate 5, GORM 5 provides all the tools necessary to integrate modern backend applications with your database.

The latest Grails documentation also has a What’s new in Grails 3.1 section.

Upgrading from a Grails 3.0 application or plugin generally requires just an version update to gradle.properties but there might be some manual things to do as described in the Upgrading from Grails 3.0 section.

Grails Expert Tip #8 – There’s a Bean for That

Recently I code reviewed some of the Grails (2.4.5) code of another team (of course 🙂 ) and here’s a snippet I came across. In some “search helper service”:

This team somehow needed some ‘generic’ way of counting the amount of records in the database, I thought. First questions which popped up were: what can be put in the passed collection? … Lees verder Grails Expert Tip #8 – There’s a Bean for That

How to mock configuration in a Grails unit- or integration test?

Sometimes you may need to mock Grails (application) configuration in an unit or integration test. E.g. you want to test code which normally would access the property jmxEnabled from the following configuration block: In Grails 2 in Config.groovy

or Grails 3 in application.yml

Here’s are the most simple options for a Grails 2.4.x or Grails 3.0.x Spock unit- or integration … Lees verder How to mock configuration in a Grails unit- or integration test?