As
Holders.grailsApplication.mainContext.servletContext.getRealPath("/")
is not available anymore in application.groovy in recent Grails versions, I wonder how to get dynamic (webapp-name-dependent) datasources working again?
see
https://github.com/grails/grails-core/issues/10131
the same applies for Holders with the extend that in runtime.groovy, Holders.grailsApplication is not available so I cannot find a way to set properties with values related to the context path.
Now I try to find a way to get our deployment scenario (same webapp deployed on same server, but each has another datasource)
Related
REcently upgraded my springcloud data flow version and I cant configure the trigger sources.
2.1.0 version
I cant configure it now... any help please ?
Thanks!!
The application properties were removed in favor of common spring integration properties. We will look into adding these to the property dialog. Meanwhile, you should be able to manually type them into the stream definition or set as deployment properties. https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationProperties.java#L325 e.g., --spring.integration.poller.fixedDelay=2000
I am trying to upgrade a Grails 1.2.x project to the minimum version which supports JDK 1.8 (=Grails 2.5.0) so that I modify the written code as less as possible.
After I managed to resolve all the dependencies, create the .war file and start it (on a jBoss 7 server) I get the mentioned error in the title when from a Controller class I do a call such as Result.list() (the Result being the domain class).
I do have multiple datasources configured, it seems the jndi names are OK and I can connect to the used DB (I got errors when these were not OK).
I tried to put #Validateable as I red somewhere on the class, but no use.
Any ideas or tips what could I try else? I suspect it is something related to DB, not have no idea how to approach it.
I am working with Grails 2.4.2 and Tomcat 7 in Debian server.
Suppose I need to change a label of a field. If I change the label in server's view directory it is not working.
All I have to do is creating war again and deploy. But so far as I know, if any changes made in views no need to create war and deploy again.
In my opinion, the best way to deal with any dynamic content is to externalize it. Save the dynamic content into an external file where you can modify it. Grails' reloadable configuration could be of a great help. See http://www.tothenew.com/blog/externalize-and-reload-grails-configuration-dynamically/ to get an idea how this could be done.
What are the minimal properties that must be set inside a Grails (2.3.6) app's BuildConfig.groovy file?
According to the documentation:
Grails has a set of core settings that are worth knowing about. Their defaults are suitable for most projects, but it's important to understand what they do because you may need one or more of them later.
However this doesn't necessarily confirm that they all have defaults. So I ask: is there a minimal set of properties for this file?
You don't have to set anything in here. If your app uses the default database (H2), the default Grails plugins, and has no JAR dependencies other than those provided by Grails, you don't need to make any changes to it.
However, for most applications the above is not true.
Is there a way to override at runtime the value of a property defined in a message bundle?
My grails application contains a property in the messages.properties file:
page1.para1.text=Some text to display to the user
My Config.groovy defines the following config location:
grails.config.locations = [ "file:${userHome}/.myApp/myApp-config.properties" ]
I currently use this approach to override Config.groovy properties (like db connections, etc), but it doesn't seen to apply to message bundle properties.
I was hoping/expecting to just make sure that the myApp-config.properties file contains my new property value, restart the Tomcat server where my app is deployed and it would get picked up and displayed on my page:
page1.para1.text=Some DIFFERENT text to display to the user
Grails docs on Internalization/Message bundles grails i18n doesn't suggest if this is possible or not.
Obviously, I'm trying to achieve this change without the need to recompile and redeliver my Grails application.
Any ideas?
Thanks in advance.
When you are already live and don't want to create a new .war file:
I'm not sure, but the .war file can be found unzipped on the server. You might try to replace the message files directly on the server, but a restart of the app might be necessary. But I wouldn't advice doing so.
If you need to often change the message bundles at runtime, I guess it would make sense to store them in the database. But that means that you have to change your code a little bit and redeploy it once. There is a blog entry which describes how to do it: http://graemerocher.blogspot.de/2010/04/reading-i18n-messages-from-database.html
Another SO question handles the case that you want to store changes to the messages in a DB but fall back to the files:
Grails i18n From Database but Default Back To File
hth
In theory you should be able to replace the messageSource bean with a ReloadableResourceBundleMessageSource inside Resources.groovy. This way you can not only point it to a new location but also declare how often they should be invalidated as cached values.