Grails

Defining a bean by calling function on another bean

In Grails, We can define custom beans in resources.groovy. A simple bean definition looks like [java] myClass(MyClass) [/java] Read more about them here. Recently, I wanted to define a bean, where the bean's constructor required me to call a method on another bean to be instantiated. To make it more clear, Let us consider a...

by Sachin
Tag: Spring
10-Dec-2014

Grails

Restricting concurrent sessions for a single user using Grails and Spring Security

Restricting concurrent sessions for a single user is a very common requirement for any software tool which requires licensing based on number of users. You can read about how we can manage (or allow) concurrent sessions with Grails 2 using Spring security plugin in this awesome concise blog here. let us see how we can allow or...

by Dhanendra Kumar
Tag: Spring
04-Dec-2014

Android, Grails

Day 4 at SpringOne 2GX 2014 | The Finale

The final day of SpirngOne 2GX went just like a Mega Finale where they kept best for the last. There were only 3 sessions today, but each one was like one of the best. Here the few highlights of the sessions #  Micro Service Architecture with Spring Boot and Groovy : Marco Vermeulen Beautifully explained the concept of micro...

by Uday Pratap Singh
Tag: Spring
12-Sep-2014

Grails

Day 1 at Springone2gx 2014 | Opening night keynotes

The much awaited conference of the Java ecosystem "SpringOne 2GX" started in Dallas at the Omni Dallas Hotel with a jam packed hall full of eager registrants. The hall was fully packed pretty soon with 1000+ attendees and we talked to around 250+ people about IntelliGrape, Grails and the amazing work we do at IntelliGrape. We were amazed...

by Uday Pratap Singh
Tag: Spring
09-Sep-2014

Grails

Using Spring Events in Grails

Hi all, I have published a new blog post Using Spring Events in Grails. Spring Events are basically used to perform events asynchronously. In my use case I need to save hundreds of records in the database. So I use Spring Events to save records asynchronously. There is a plugin available in Grails for using Spring Events which...

by madhav.khanna
Tag: Spring
17-Jul-2014

Application Security, Grails

Spring Security & Grails: Cross domain authentication from HTTP to HTTPS

We were trying to implement SSL-based login and registration (i.e. HTTPS) in an e-commerce web application which was otherwise using the non-secure protocol (i.e. HTTP) for the entire website. Instead of moving the entire web application to SSL, which would have increased response times, we thought it would be best if only the...

by Roni C. Thomas
Tag: Spring
01-Oct-2013

Grails

How to implement AOP Profiling in Grails application

In one of my recent project, i want to profile method execution time. I have used Spring AOP to profile method execution time. It's very easy to implement AOP profiling in grails 1. Suppose we have below mentioned service class, we want to log execution time of method saveDataStudent,saveDataUpdated methods in service class. We need...

by Mohit Garg
Tag: Spring
25-Sep-2012

Grails

Attributes of Spring Cache

In my previous blog, i have mentioned how to integrate spring cache plugin in grails. In this blog we will see how we can use different attributes of cache. Different attributes of cache :- maxElementsInMemory- How many elements you can store in cache overflowToDisk-The attribute overflowToDisk is true, meaning that whenever the...

by Mohit Garg
Tag: Spring
25-Sep-2012

Grails

How to integrate Spring cache plugin with Grails

In one of my recent project, i want to cache  method output. For implementing method level cache, i have used spring cache. For implement Spring cache, we can use grails cache plugin. It's very easy to integrate cache plugin with grails. 1. Add following plugin dependency in BuildConfig.groovy. [groovy]compile...

by Mohit Garg
Tag: Spring
25-Sep-2012

Grails

Using PostConstruct annotation with Grails Services

We can use PostConstruct with Grails Services and injected Spring Beans. This PostConstruct annotation can be used to annotate a method which needs to be executed after dependency injection to perform any initialization. [code] import javax.annotation.PostConstruct class PostConstructDemoService { @PostConstruct private...

by Ankur Tripathi
Tag: Spring
27-Aug-2012

Grails

Integrating Spring AOP with Grails Application

AOP means Aspect Oriented Programming Enables encapsulation of functionality that affects multiple classes in separate units. Complements Object Oriented Programming. Cross Cutting Concerns : Functionality whose implementation spans multiple modules. Different From OOPS Sometimes we want to implement common functionality...

by Mohit Garg
Tag: Spring
27-Aug-2012

Grails

Overriding properties in a Spring Bean with BeanFactoryPostProcessor

I was going through the source code of one of the Grails Plugins where I found the use of Spring's BeanDefinitionRegistryPostProcessor to override some configurations that are available in DataSource.groovy. That involved a complete over riding of a PropertyValue definition.   It set me thinking about whether there is a way to...

by Vivek Krishna
Tag: Spring
12-May-2012