Subscribe with Email

Comment

A combination of wrist pain, a lot of work, family obligations have kept me out of the newsletter for the past weeks. Apologies for that. I am back with a classic - a mix of Groovy / Micronaut / Grails content.

Sergio del Amo

Groovy

As someone who likes learning with Books, @adamldavis's book Learning Groovy 3 is the perfect guide to get me ready for Groovy 3 release:

Also, Learning Groovy 3 has been updated to Groovy 3.0 to include the new Parrot parser which was extended to support additional syntax options and language features. It also includes coverage of Groovydoc, which allows you to embed Groovydoc comments in various ways. And, this book covers how Groovy supports Java type annotations and more.

It seems the folks of JetBrains are considering built-in support for Micronaut within IntelliJ. As someone who uses Micronaut and IntelliJ all day everyday, this is something I super excited about. Please, give them a thumbs-up to signal them that the community wants support for Micronaut in IntelliJ IDEA.

Typically security and similar cross-cutting concerns are best handled with aspect-oriented programming style which means using interceptors in the Grails environment.

Using interceptors makes total sense because probably Spring Security Core plugin annotations don't suffice for them. Maybe, they need to to check not just whether the user has a role but if the user is trying to read an entity belonging to a tenant which the user has access to.

For exceptional states, there are exceptions in Java. You can move the code into the service and throw exceptions at the points where would you normally return from the controller action:

For almost the whole year, I am working in a Micronaut project written in Java with Groovy tests with Spock. We are using a similar approach: a lot of Runtime exceptions in the service layer to keep controller methods dry and then we combine declarative controller exception handling and in some cases global handling.