grails

Grails app only use maven to run, drop support for grails

萝らか妹 提交于 2020-01-16 19:01:06
问题 I have a grails application with maven enabled. Application is running fine using both: grails run-app and mvn grails:run-app Now my requirement is to run application using maven only and if application is executed using grails run-app a message is displayed to run the application using maven. 回答1: Please have a look at Grails Disable run-app command. I was also facing the same issue. Thanks 回答2: I don't know if it's possible in grails, but you can work it around by setting a system property

Grails: update view on data change

帅比萌擦擦* 提交于 2020-01-16 18:31:07
问题 What I would like to do is to update a .gsp page on data is change. Something like this: http://weichhold.com/2009/07/20/updating-multiple-page-fragments-with-grails-and-ajax/ but here the content page doesn't change on data changes. There is a easy way to do this? 回答1: The usually approach to updating the UI without a complete page refresh is through Grails AJAX calls. However based on the limited information you have provided, I think you would need to implement some sort of polling

Custom UserDetailsService Not Being Called - Grails & Spring Security Core

徘徊边缘 提交于 2020-01-16 07:41:07
问题 I'm using Grails v2.4.2 with spring-security-rest, spring-security-core, and spring-security-ui plugins. I've written a custom UserDetailsService to make the username case-insensitive. All I am doing is simply trying to override UserDetails loadUserByUsername(String username, boolean loadRoles) throws UsernameNotFoundException My com.example.core.CaseInsensitiveUserDetailsService class is defined as: class CaseInsensitiveUserDetailsService extends GormUserDetailsService { /** * Make The

Spring security core framework getting configured twice in Grails Spring security core plugin

混江龙づ霸主 提交于 2020-01-16 06:40:43
问题 I am using Grails spring security core plugin version 3.0.3. The debug statements when configuring the spring security core framework are printed twice and the filter chain is also initialized twice WARN grails.plugin.springsecurity.SpringSecurityCoreGrailsPlugin - Configuring Spring Security Core ... Configuring Spring Security Core ... WARN grails.plugin.springsecurity.SpringSecurityCoreGrailsPlugin - ... finished configuring Spring Security Core ... finished configuring Spring Security

Grails/Groovy: Modify a “query” closure at runtime

耗尽温柔 提交于 2020-01-16 04:58:08
问题 In a gorm domain class, I can do def q = { property1{ eq('attr', 0) } } MyDomainClass.list(q) How could I modify the closure 'q' (or create a new closure that would contain the restrictions that closure 'q' has) at runtime so for example I could add another property restriction? More details Actually my problem is how to create combined criteria in a Domain Class Hierarchy. class Parent{ int pAttr static def getCriteria(){ def dummyParentCriteria = { eq('pAttr', 0) } } } class Child extends

Grails Mapping LocalDateTime of Java 8 domain objects to Gorm

让人想犯罪 __ 提交于 2020-01-16 04:50:09
问题 Java 8 gives the java.time API. I am using a grails application, I want to use java.time for properties of my domain classes. I need to map for instance the LocalDateTime to the DATE/DATETIME on GORM which is built on top of Hibernate. How can I persist my mappings? I see a solution, that I can use jadira, and establish static mappings for my attributs. However is there another way? Please any help is appreciated. 回答1: You can use the user type mapping. See the docs. That should remove the

How do I upgrade the Grails version for an existing application?

让人想犯罪 __ 提交于 2020-01-16 00:52:14
问题 I have an example Grails application (from Grails in Action) that was created a while ago under version 1.1.1 on a different PC. I am now loading Grails 1.2.0 and want to revisit the app. However, when I try to run it I get this message: Application expects grails version [1.1.1], but GRAILS_HOME is version [1.2.0] - use the correct Grails version or run 'grails upgrade' if this Grails version is newer than the version your application expects. After reading around a bit I cleared out the 1.2

Grails session-scoped service - not working

与世无争的帅哥 提交于 2020-01-15 22:27:47
问题 I added static scope = "session" in one of my Grails services (Grails 2.2.2), but for some reason it is behaving like a singleton. Can you not inject session services into singleton (default) services? In other words, is there any reason why this shouldn't work? class DefaultService { def sessionService } class SessionService { static scope = 'session' def instanceVar = ... } How would I troubleshoot why this isn't working? 回答1: I hope this help you. In short, you can not use session scoped

Grails - DuplicateKeyException

狂风中的少年 提交于 2020-01-15 12:47:30
问题 I have got the following piece of code which adds new object to database. Firstly it takes another object from DB and add to the final object. Few lines of my code ClassC c = ClassC.findByName(cName) ClassD d = new ClassD( name: "WHATEVER", classC: c ) print "AAA\n" ClassC.withTransaction { c = c.merge() // c.save(failOnError: true, flush: true) } print "BBB\n" // ClassD.withTransaction { // d = d.merge() // } // print "CCC\n" ClassD.withTransaction { d.save(failOnError: true, flush: true) }

Failed to validate a newly established connection with grails 3.3.5

半城伤御伤魂 提交于 2020-01-15 12:44:36
问题 I am using grails 3.3.5 and I have configured my application.yml with some properties in my production data source bellow properties: jmxEnabled: true initialSize: 5 maxActive: 50 minIdle: 5 maxIdle: 25 maxWait: 10000 maxAge: 600000 timeBetweenEvictionRunsMillis: 5000 minEvictableIdleTimeMillis: 60000 validationQuery: SELECT 1 validationQueryTimeout: 10 validationInterval: 15000 testOnBorrow: false testWhileIdle: true testOnReturn: false jdbcInterceptors: ConnectionState