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 7942041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:50:52+00:00 2026-06-03T23:50:52+00:00

DataSource.groovy appears to be evaluated before BootStrap.groovy. But, I need to setup something up

  • 0

DataSource.groovy appears to be evaluated before BootStrap.groovy. But, I need to setup something up so that I can invoke some static methods in DataSource.groovy (my database setup is complex).

More Info:

If I was doing this up without Grails, I would probably create a DataSourceFactory Spring Bean. I would then declare dependencies between this bean and other code such that I could explicitly control when everything was initialized. Within my DataSourceFactory class’ PostConstruct method, I would execute the code needed to call my company’s property/configuration framework to get the necessary DB connection information.

So, what I’m looking for is complete (or at least more) programatic control over how the JDBC DataSource is constructed.

  • 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-03T23:50:53+00:00Added an answer on June 3, 2026 at 11:50 pm

    DataSource.groovy is evaluated as an executable groovy file. Why don’t you just call your methods right at the start? For example:

    MyApp.doExtraDatabaseConfig()
    
    dataSource {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Grails 2.0 seems to have some changes to DataSource.groovy and I don't seem to
I need to configure a datasource to use in grails. I created file scripts/_Events.groovy
I have an Entity datasource, which I need to filter before passing it to
I have a datasource (BindingList) with many Users, but there are some users I
I have a service that uses Groovy SQL to make some sql calls to
I'm implementing a datasource object for an UIScrollView. Is that part of the Controller,
Given a datasource like that: var c = new Car[] { new Car{ Color=Blue,
I'm trying to access datasource before I bind it to grid. How do I
I am using datagridview and its datasource is a BindingList. But when I try
I do this : DataSource.groovy: hibernate { cache.use_second_level_cache=true cache.use_query_cache=true cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider' } and in BuildConfig.groovy:

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.