grails

Grails upgrade from 1.0.5 to 2.4.4

自闭症网瘾萝莉.ら 提交于 2020-01-15 06:59:09
问题 I have a collection of applications written in Grails v1.0.5. The application does work flawlessly. But, I'm looking into the possibility of upgrading to the latest version(2.4.4). I know it is quite a huge leap starting from 1.0.5 but any pointers on where to start? Official site holds documentation only from 1.2.0(makes me feel like I'm in old age). Any help would be much appreciated. 回答1: The safest way to upgrade an application from 1.x to 2.x would be to create an empty 2.x project, then

Grails unit test verify mock method called

不羁岁月 提交于 2020-01-15 05:45:51
问题 In my unit test, I mock a service (which is a ref of the class under test). Like: given: def mockXxService = mockFor(XxService) mockXxService.demand.xxx(1) {->} service.xxService = mockXxService when: service.yyy() then: // verify mockXxService's xxx method is invoked. For my unit test, I want to verify that mockXxService.xxx() is called. But grails document's mockControl.verify() doesn't work for me. Not sure how to use it correctly. It is very similar to mockito's verify method. Anyone

Spring security no password encoding

冷暖自知 提交于 2020-01-15 05:18:07
问题 Would it be possible to turn off password encoding in Spring Security? If so, how? 回答1: It's a really really bad idea in general, but if you have a use case for it then it is doable. Override the passwordEncoder bean in grails-app/conf/spring/resources.groovy : import org.springframework.security.authentication.encoding.PlaintextPasswordEncoder beans = { passwordEncoder(PlaintextPasswordEncoder) } 来源: https://stackoverflow.com/questions/8465016/spring-security-no-password-encoding

Does externalizing sensitive config variables into a .properties outside of Config.groovy provide a security advantage in Grails?

佐手、 提交于 2020-01-15 03:47:39
问题 I understand that in Grails by default configuration vars are stored in Config.groovy and once deployed the properties are contained within the war. Obviously this would cause issues if you needed to change them without redeploying the app. However, I just read the following in the Grails AWS Plugin docs: "As recommended by Amazon, you can use a .properties file to handle your secret and access keys for this plugin." ... "Sometimes, you still don't have access to filesystem, but don't want to

How to prevent from Grails not to delete child while deleting parent?

本小妞迷上赌 提交于 2020-01-15 02:47:24
问题 i have one to many relationship between author and books, one author has many books.. i have domain class like this Author.groovy class Author { String authorName; String authorAddress; String authorCNIC; static hasMany = [books:Book] static constraints = { books(nullable: true) } } Book.groovy class Book { String bookName; String Isbn; static belongsTo = [author:Author] static constraints = { author(nullable: true) } } now when i call this function def deleteauthor() { def id=params.id

Custom RoleVoter And Accessing UserRole for additional vote check

ぐ巨炮叔叔 提交于 2020-01-15 02:39:08
问题 Taking the suggestion provided here, I've implemented my own RoleVoter classes that extends RoleVoter and the additional check I need to add is that the User, Role, and Organization all line up based on the Organization I have stored in the session. I have the following UserRole class: class UserRole implements Serializable { User user Role role Organization organization .... } And this is my OrganizationRoleVoter class: class OrganizationRoleVoter extends RoleVoter { @Override public int

How do I trigger a job when another completes?

只谈情不闲聊 提交于 2020-01-15 01:21:15
问题 I have two jobs, consider them to be the super simple jobs that just print a line and have no triggers or timeouts defines. They work fine when I call them from a controller class through: <name of my class>Job.triggerNow() What I want is to trigger one job and, as it as it finishes, trigger a consequent different job. I have tried using the quartzScheduler , but I can't seem to get a JobDetail from my job classes, so I'm not sure what is the correct way for doing this. I also want to pass

How do I override the cascade delete for a relation in Grails GORM?

我怕爱的太早我们不能终老 提交于 2020-01-14 19:38:27
问题 I'm having some problems with the GORM part of Grails. I am using Grails 1.3.4, together with H2. In the database I have two tables template and report . On the GORM-level I have the two Domain classes Template and Report ; class Template { static hasMany = [reports: Report] ... } and class Report { static belongsTo = [template: Template] ... } Default behaviour seems to be that when a Template is deleted, the deletion will be cascaded so that all Report s that it has will be deleted as well.

Grails: Defining a JSON custom marshaller as static method in domain

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 19:21:27
问题 I'm using Grails 2.4.2. As can be seen here: https://grails.org/Converters+Reference You can create a static method in your domain with your custom marshaller to render the JSON in the controller. Like that: Domain: // a class to output in JSON package com.sample class User { String login String passwd // JSON definition of the User object static { grails.converters.JSON.registerObjectMarshaller(User) { return [ login: it.login ] } } Then in your controller: def user = new User(login:'bob',

Grails Elastic Search Plugin SEVERE: Unexpected transforming call sites grails elasticsearch

て烟熏妆下的殇ゞ 提交于 2020-01-14 19:21:08
问题 I'm trying to install the elastic search plugin (elasticsearch:0.0.4.4) on my Grails project (grails version 2.4.4) and after adding the plugin dependency and running the app (grails run-app) I get some rather severe errors. Stacktrace: Apr 02, 2015 9:44:08 AM org.springsource.loaded.agent.SpringLoadedPreProcessor preProcess SEVERE: Unexpected problem transforming call sites java.lang.IllegalStateException: Unexpected problem processing bytes for class at org.springsource.loaded