Reputation: 8963
I have an external java library I am using in my Grails project. It needs a DataSource via the Spring configuration. However, the dataSource appears to not be accessible from resources.groovy. How do I get access to it? I'm using the following in resources.groovy:
beans = {
eventDao(com.JavaClassRequiringDataSource) {
//dataSource = ref(dataSource, true)
dataSource = dataSource
}
}
Running the app results in a exception:
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingPropertyException: No such property: dataSource for class: grails.spring.BeanBuilder
Any ideas?
Upvotes: 5
Views: 6493
Reputation: 3124
According to http://www.grails.org/Spring+Bean+Builder your method should be right.. I just did some Googleing and found that this should do it (untested):
beans = { eventDao(com.JavaClassRequiringDataSource) { dataSource = ref('dataSource', true) } }
so you do not reference it by variable, but by name. (Source: http://burtbeckwith.com/blog/?cat=23)
Upvotes: 7