Home » Tag Archives: Grails

Tag Archives: Grails

Grails 3.3 Integration Testing with Spock Mocks

It is easy to use the Spock Framework, shipped with Grails, to mock or stub a collaborator (such as a service) in our Grails unit tests. The Testing chapter explains a bit about mocking collaborators, doWithSpring/doWithConfig callback methods, the FreshRuntime annotation to mock beans in tests — but they’re mainly for unit testing. How about mocking beans in an integration ...

Read More »

Grails 3.3 has Spock 1.1

You’ll be glad to know that milestone 1 of Grails 3.3 has been released 3 days ago — and is also already available through SDKMAN!. Not only has it upgraded its dependencies to Hibernate 5.1.5, Spring Framework 4.3.7, Spring Boot 1.5.3 and Gradle 3.5, but it also finally ships with the latest Spock 1.1 testing framework. Spock is an old ...

Read More »

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 the ...

Read More »

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” ...

Read More »

Debugging Grails 3, Spring Boot or Gradle with Eclipse

This is a small post for those who’s primary IDE is Eclipse for developing Grails 3 apps or plugins — and are still wondering how to debug their application. First of all, to clarify: there’s no “Grails” debugging, it’s just Spring Boot and Gradle these days, with Grails 3. Any way to debug these kind of applications allows you to ...

Read More »

Groovy for Java Developers?! Meet Gradle, Grails and Spock

What are some of the most interesting Groovy use cases for Java developers? Although it’s been around for a while, it seems that only lately Groovy has been getting its Groove on. It is mostly just another esoteric JVM language for some, but it’s more popular than you think thanks to some popular tools that use it to help you ...

Read More »

Building GORM Criteria Queries Dynamically

I originally wrote most of the queries in the spring-security-ui plugin using HQL because I find it more intuitive than criteria queries, but HQL only works with Hibernate and relational databases. A pull request updated the queries to use criteria queries to allow the plugin to be used with NoSQL datastores, but one query didn’t fit the programming style that ...

Read More »

Grails 3 DataSource Configuration

Grails 3 has new configuration files and format.  The new format is based on YAML and the file name to use for database configuration is grails-app/conf/application.yml.   I’m just getting started with Grails 3 after developing applications on Grails pre-1, 1 and 2.  I was looking forward to building a new Grails 3 application. Before I began, I read the ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns