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?
Grails is an open source web application framework that uses the Apache Groovy programming language (which is in turn based on the Java platform).
Grails is a Java-based web application framework that uses the Apache Groovy programming language.
Grails is superb because it allows developers to concentrate more on actual application requirements and spend less time configuring the framework. Grails provide tools for development, and it is built based on tools like: Quarts, Hibernate, Spring, and Gradle for library management.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With