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

  • Home
  • SEARCH
  • 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 520629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:09:55+00:00 2026-05-13T08:09:55+00:00

I’m currently in the process of building a CRUD tool for an existing Spring-based

  • 0

I’m currently in the process of building a CRUD tool for an existing Spring-based application.
The application is being included in the Grails app as a JAR library which seems to work fine.

To make use of the library’s own spring context, I used to load it through:

def ctx = new ClassPathXmlApplicationContext( 'classpath:/applicationContextName.xml')

in my service. Unfortunately the context builds its own datasource (the library’s default) which is no good, as I need to use the dataSource defined in Grails.

So, my solution was to just include the library’s spring configuration with the Grails context by adding an import to the grails-app\conf\spring\resources.xml file.

This seems to work (in so much as all beans are loaded into the same context and I can now autowire the beans straight in to my service classes by using def variableName.

Unfortunately, the dataSource defined in the library’s spring config is overloading the dataSource defined in my Grails DataSource.groovy file!

Is there any way I can tell Grails to load the libary’s spring configuration first, so that it then gets overridden by the rest of Grails config (and thus using Grails’ DataSource)?

Thanks for your help,

James

…

As a tenporary measure, I’ve removed the dataSource entry in the dependancy’s spring config file and its beans have been injected the dataSource created by the Grails config – this isn’t ideal though, as I’ve had to make a ‘special’ build of the dependancy jar.

  • 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-05-13T08:09:55+00:00Added an answer on May 13, 2026 at 8:09 am

    I’d look at making a trivial plugin containing your library and get it to load before the dataSources plugin (use def loadBefore = ['datasources'] in you *Plugin.groovy file).

    Each plugin has a doWithSpring hook which lets you add beans to the context (you could include your existing context.xml there).

    As an added bonus it will make it easier to re-use the library next time 🙂

    cheers

    Lee

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to

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.