views:

418

answers:

1

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  A: 
Pascal Thivent
tried, but with no success :( And also there aro no any security.groovy anywhere in classpath, grails compiled it into security.class I thins that it the root of problem, but don't know how to fix this
splix
thanks, hack with _Event.groovy are helped me
splix