Home » Tag Archives: Grails (page 2)

Tag Archives: Grails

Grails domain classes and special presentation requirements

grails-logo

In Grails we often use our domain objects directly as backing model for presentation purposes and only for specialized situations we create value holder objects or DTOs. Beginning Grails developers know how to display individual entity properties pretty easy in a GSP, such as the name of a fictional domain class…             <g:each in=”${breedingGoals}” var=”breedingGoal”> ...

Read More »

Grails Tutorial for Beginners – Grails Service Layer

grails-logo

This tutorial will discuss the importance of the service layer in Grails and how to work with it. It also explains transaction management and how to utilize it. Introduction Separation Of Concerns Consider this analogy: Imagine a company where employees are assigned tasks on different nature of work. For example, say there is an employee named John Doe with the ...

Read More »

Grails Spring Security Core Plugin – Registering Callback Closures

grails-logo

I was searching for a way to hook business logic after successful user login while using Spring Security Core plugin. The simplest way to do this is to register callback closures. It let’s you hook your custom code inside Config.groovy after certain Spring Security events. If you are unfamiliar with this plugin, visit the previous tutorial on Spring Security Core ...

Read More »

Grails Generate Asynchronous Controller

grails-logo

Since version 2.3, Grails supports asynchronous parallel programming to support modern multiple core hardware. Therefore a new Grails command is added to generate asynchronous controllers for domain classes. The generated controller contains CRUD actions for a given domain class. In the example below, we will generate a default asynchronous implementation of a Grails controller. First we create a domain object: ...

Read More »

MongoDB and Grails

groovy-logo

So recently, I had a requirement to store unstructured JSON data that was coming back from a web service. The web service was returning back various soccer teams from around the world. Amongst the data contained in most of the soccer teams was a list of soccer players, who were part of the team. Some of the teams had 12 ...

Read More »

Grails tip: refactoring your URLs

grails-logo

On the current project I am working we use a lot of integration tests. For you non-Grails users out there, Integration tests test your Controller APIs, your Services and any persistence that might happen all very neatly. The only slice of the cake they don’t test from a back end perspective are your Grails filters for which you’d need something ...

Read More »

Grails Goodness: Extending IntegrateWith Command

grails-logo

We can extend the integrate-with command in Grails to generate files for a custom IDE or build system. We must add a _Events.groovy file to our Grails projects and then write an implementation for the eventIntegrateWithStart event. Inside the event we must define a new closure with our code to generate files. The name of the closure must have the ...

Read More »

The Grails depedency injection inheritance pitfall

grails-logo

This blog post is about a small pitfall you should be aware of when combining dependency injection in Grails with inheritance. I think the problem is best explained with a piece of example code. So let’s look at the following two definitions of Grails controllers.             class FooController {   TestService testService   def foo() {     // do something with testService   } } class BarController extends FooController {   TestService testService   def bar() { ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close