Details
Description
- I created Grails 1.0-rc4 application.
- I created the following controller:
class HelloController { def str1 def str2 def exampleService def index = { def serviceResult = exampleService.serviceMethod() render "hello $str1 and $str2. $serviceResult" } } - I created the following service:
class ExampleService { def str1 def str2 boolean transactional = true def serviceMethod() { "$str1 and $str2" } } - I updated resources.xml:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="str1" class="java.lang.String"/> <alias alias="str2" name="str1"/> </beans>
- Then I went to http://localhost:8080/myapp/hello and see "hello and null. and null".
It seems that autobinding does not work with spring aliases both in Controllers and Services.
hey- I think this is broken again. You seem to have lost the part of patch that fixed this bug in a later revision. This is just for grails/src/commons/org/codehaus/groovy/grails/commons/spring/GrailsRuntimeConfigurator.java- the other two files from the commit seem to be ok. The changes in 6535 for that file are removed in commit 6575. Without the patch aliases don't appear to work in resources.xml. When I reapply it they do, at least for me.
here's the fix that's now missing:
http://fisheye.codehaus.org/browse/grails/trunk/grails/src/commons/org/codehaus/groovy/grails/commons/spring/GrailsRuntimeConfigurator.java?r1=6409&r2=6535&u=3&ignore=&k=
here's where it went away:
http://fisheye.codehaus.org/browse/grails/trunk/grails/src/commons/org/codehaus/groovy/grails/commons/spring/GrailsRuntimeConfigurator.java?r1=6571&r2=6575#seg61