Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:32:13+00:00 2026-06-07T00:32:13+00:00

I have an application developed in Grails 2.0.4, I am hard coding some of

  • 0

I have an application developed in Grails 2.0.4, I am hard coding some of the values in my domain classes, example as follows

class Training{
  String startTime ="09:00"
  String endTime  ="17:00"
}

But Its not good approach, Making changes is overhead, Like this I have got more than 10 domain classes where the values are hard coded.

So, I am planning to create a separate configuration Domain class, thereby I can input the values through the UI (view) and persist them.

This is my plan, Is there any solution in grails to deal with it.

UPDATED:

import org.grails.plugins.settings.*

class PublicTraining extends Training{
    Date startDate = Setting.valueFor("startDate")
}

I have created a setting ‘startDate’. I am able to access setting using Setting.valueFor(“startDate”) method in controllers but not in domain classes

The error I am getting is below

*Caused by: org.hibernate.InstantiationException: could not instantiate test objectcom.springpeople.tms.PublicTraining
    ... 5 more
*Caused by: java.lang.reflect.InvocationTargetException
    ... 5 more
Caused by: groovy.lang.MissingMethodException: No signature of method: org.grails.plugins.settings.Setting.methodMissing() is applicable for argument types: () values: []
    at org.grails.plugins.settings.Setting.valueFor(Setting.groovy:53)**
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:32:15+00:00Added an answer on June 7, 2026 at 12:32 am

    Check out the Settings plugin. I use it in almost every project. Allows you to create any number of these type of config settings and access them in GSP’s or Contollers/Services/etc. It even provides a CRUD gui to manage them.

    //programatically
    import org.grails.plugins.settings.*
    
    def startTime = Setting.valueFor("startTime")
    def endTime = Setting.valueFor("endTime")
    
    //gsp
    <g:setting valueFor="startTime" default="9:00" encodeAs="HTML" />
    

    To use it in domain classes I’ve always used the beforeInsert or beforeUpdate events.

    Handles settings of types String, Integer, BigDecimal or Date.

    If you had multiple values that are similar(like “Training start time” and “Inventory start time”) you needed to store you can segment them as inventory.startTime and training.startTime as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a grails application that stores a great deal of information. Currently,
We have developed a Web Application using grails, groovy and oracle as database with
I have developed an application in Grails. It uses Vaadin framework for GUI. It
I have developed a grails/groovy application for a legacy database which has user maintenance
We have developed an application using Grails, intended to be hosted on our public
I have developed application for drawing some shapes (lines mostly) , now i need
I have developed an application in Grails (1.3.7) and I am running it on
I have an application developed in groovy on grails(1.1.1). I've used a hibernate enable
I have an application developed in Zend Framework 1.11. I use Zend_OpenId to create
I have an application developed with Visual Studio 2008 and distributed throught ClickOnce. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.