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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:20:30+00:00 2026-05-13T19:20:30+00:00

Grails have cofig for spring bean called resources.groovy . And as i understand from

  • 0

Grails have cofig for spring bean called resources.groovy. And as i understand from docs it allows you to include another file, using loadBeans(%path%)

I’m tried with this:

println 'loading application config ...'


// Place your Spring DSL code here
beans = {
    loadBeans("classpath:security") //i'm tried with "spring/security" and "spring/security.groovy" also

}

but when grails is running it log following error:

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Error evaluating bean definition script: class path resource [security] cannot be opened because it does not exist
Offending resource: class path resource [security]; nested exception is java.io.FileNotFoundException: class path resource [security] cannot be opened because it does not exist
 at grails.spring.BeanBuilder.loadBeans(BeanBuilder.java:470)
 at grails.spring.BeanBuilder.loadBeans(BeanBuilder.java:424)
 at resources$_run_closure1.doCall(resources.groovy:13)
 at resources$_run_closure1.doCall(resources.groovy)
 ... 45 more

Script security.groovy is exists at grails-app/conf/spring and compiled by grails maven plugin into target/classes/security.class.
Directory target/resources/spring is empty at this time

How i can configure Grails or grails-maven-plugin to copy this config files, not compile it into classes?

p.s. this problem also presents when i try to include config scripts using grails.config.locations = [ %path% ] inside conf/Config.groovy, my groovy scripts compiles into classes and because of it, grails config builder can’t find them 🙁

  • 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-13T19:20:31+00:00Added an answer on May 13, 2026 at 7:20 pm


    Did you try:

    println 'loading application config ...'
    
    
    // Place your Spring DSL code here
    beans = {
        loadBeans("classpath:*security.groovy") 
    
    }
    

    (this should load all Groovy files on the classpath ending with security.groovy and parse them into bean definitions).

    Update: Found an interesting thread with this message as reference and my understanding is that one trick is to use ant in scripts/_Events.groovy to copy the .groovy file to the classesDirPath dir and then simply use:

    beans = {
        // load spring-beans for db-access via spring-jdbc-template
        loadBeans('security.groovy')
    
        // load some other spring-beans
            ...
    }
    

    This looks like a hack to get things working in both the war and when running run-app though. Not sure how things “should” be done (if this even makes sense).

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

Sidebar

Related Questions

In my configuration's spring/resources.xml file, I define a bean like this : <bean id=myService
I have put a file in my grails-app/conf package called size_config.xml . When the
The select form component in grails can have the form: <g:select name=user.age from=${0..59} value=${age}
I have a Grails app that loads its data from xml files and delivers
I have one grails application.In that I have one model class named Book. From
Let's say we have a grails web application exposing several resources. tags urls users
Recently I've been playing a bit with Groovy and Grails and I have to
I have a groovy/grails application that needs to serve images It works fine on
Here is the scenario. I have an file outside of my Grails application that
I have this log4j configuration in my grails config.groovy log4j = { error 'org.codehaus.groovy.grails.web.servlet',

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.