Questions tagged [grails-3.0]

Grails 3.0 is the next major version of the Grails framework, which introduces some radical (and also breaking) changes on the platform compared to the 2.x versions. The main differences are the use of Gradle for building and using Groovy traits for the internal APIs.

Grails 3.0 is the next major version of the framework, which introduces some radical (and also breaking) changes on the platform compared to the 2.x versions. The main differences are the use of for building and using traits for the internal APIs.

What's new in Grails 3.0?

Core Features

  • Groovy 2.4

  • Spring 4.1 and Spring Boot 1.2

  • Gradle Build System

  • Application Profiles

  • Redesigned API based on Traits

Development Environment Features

  • New Shell and Code Generation API

  • Enhanced IDE Integration

  • Application Main Class

Testing Features

  • Integration and Geb Functional Tests

  • Gradle Test Running

421 questions
4
votes
5 answers

How to load datasource configuration from external file in grails 3.1.8?

I am writing a grails 3.1.8 application. My datasource written in application.groovy file. I want to load datasource configuration like username,password,DB from an external file. Is there any way to do it in grails 3+ versions. Here is my…
Rezaul
  • 600
  • 4
  • 24
4
votes
3 answers

Grails (Hibernate) Mapping of java.time.ZoneId to Database

Is there any way how to support persistent mapping of java.time.ZoneId to string in Hibernate 5.1.1. It saves the ZoneId in binary form right now. I've just upgraded to Grails 3.2.1 which has Hibernate 5.1.1. Saving of java.time.Instant for example…
kuceram
  • 3,395
  • 9
  • 30
  • 52
4
votes
2 answers

Grails View thinks model is null

I have a Grails 3 app and I'm trying to use a view to marshall the output of my controller into a specific format. I add two views: 1. a model tied to the controller action under views/order/getOrderLines.gson and 2. a template for individual…
Charles Harris
  • 154
  • 1
  • 1
  • 16
4
votes
2 answers

Grails 3 CSRF protection

Is it possible to configure CSRF protection in grails3 app using spring-security plugin, I can't find anything except useToken attribute for grails form and then call withForm inside controller. But this is actually not a very flexible solution. I…
enzo
  • 287
  • 4
  • 12
4
votes
1 answer

How do I import an existing Grails 3 (3.0.12) project in IntelliJ 15

There's documentation on IntelliJ's website for creating a new Grails project, but importing a project is more sketchy and I cannot get it to work for me. If I tell IntelliJ to import a new project, and point it to my project directory, it does not…
IcedDante
  • 4,991
  • 10
  • 49
  • 81
4
votes
3 answers

How to run integration test for a particular class in grails 3.0

I am new to grails, and am trying to run already existing integration tests for a particular class (using grails 3.0.11).(I don't want to run ALL the test classes, just a single one) Is it possible to do that for integration tests or can only…
neel
  • 371
  • 3
  • 11
4
votes
3 answers

Grails gorm 'where' query with 'lower()' and 'in' operator

I have a Domain class class Hashtag { String tag } Why Hashtag.where { lower(tag) == "#london" }.list() works ok, but Hashtag.where { lower(tag) in [ "#london", "#paris" ] }.list() results…
Igor
  • 85
  • 6
4
votes
0 answers

Grails 3 - Alternative to @Rollback in Integration tests

Short version: I am looking for a way to attach the hibernate session to the integration test thread with auto-commit (Grails 2.x behavior). I am converting a plugin to Grails 3.0.11. Things are more or less progressing, but I found a problem with…
Mike Houston
  • 216
  • 2
  • 8
4
votes
1 answer

Failed to load ApplicationContext while running integration test in grails

I'm trying to create my first integration test in Grails. For this I executed: grails create-integration-test MyClass which created an empty IT. Thats how it looks like: import grails.test.mixin.integration.Integration import…
Peter
  • 1,480
  • 2
  • 26
  • 48
4
votes
1 answer

Grails 3 mail plugin not working

Using Grails 3 it's impossible to get an instance of mailService object, DI is not working: build.gradle compile "org.grails.plugins:mail:1.0.7" testCompile "org.grails.plugins:mail:1.0.7" application.groovy environments { development { …
Alex Shwarc
  • 688
  • 8
  • 20
4
votes
2 answers

How to define a prototype scoped bean in Groovy spring DSL

In grails one defines spring beans in resources.groovy using the spring groovy DSL beans = { myBean(MyBeanImpl) { someProperty = 42 otherProperty = "blue" bookService = ref("bookService") } } How do you define…
mzzzzb
  • 1,310
  • 17
  • 34
4
votes
1 answer

Should Grails 3.x plugin name always include 'org.grails.plugins:'?

Are Grails 3.x plugin names supposed to be org.grails.plugins:$project.name or just $project.name? The default from https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle is…
rlovtang
  • 4,730
  • 2
  • 26
  • 30
4
votes
1 answer

Why is grails.gorm.autoFlush set to true not working?

Consider the following code: class User { static constraints = { email email: true, unique: true token nullable: true } String email String password String…
skiwi
  • 59,273
  • 29
  • 118
  • 198
4
votes
1 answer

Where to place resources in Grails 3 project?

This answer addresses this problem for a Grails 2 project, but does not work for a Grails 3 project. For instance, in a Grails 2 project I was able to put an xsl file in /src/groovy/myapp/resources/ and load it similar to what the linked answer…
ubiquibacon
  • 9,834
  • 25
  • 101
  • 175
4
votes
2 answers

Grails 3: Custom Application class for integration tests

I want to customize the Application class that's used for integration tests. According to the user guide, this should be possible: The Integration annotation supports an optional applicationClass attribute which may be used to specify the…
rainerfrey
  • 403
  • 3
  • 12