<lang:groovy> tag in version 2.5 and higher doesn't work for refreshable Spring MVC endpoints [SPR-10689] #15317
THIS BUG LIES IN SPRING 2.5 AND HIGHER
Dynamic language support is added to Spring by using the
How this functions under the hood is:
a. Resolve the script source
In step (b.), to setup the architecture, the
The bug lies in the
This class contains a variable name
The value of this variable is invalid because the full qualified name of the
This means that
However, this issue did not exist in Spring 2.0 & earlier since the
3 votes, 5 watchers
The text was updated successfully, but these errors were encountered:
Phil Webb commented
There are also some tests that should verify
Are you experiencing an actual problem with the tag? Would you be able to submit a issue project that can reproduce your problem?
Dhaval Powar commented
Thanks for the quick reply. Yes, sorry, I seem to have missed that. You are right as far as the definition of the
I am currently developing a Web application which makes RESTful calls using Spring annotations such as
So I first tried to use the lang:groovy notation in the applicationContext.xml but my scripts just do not get loaded at runtime and the URLs are not mapped to the respective handler methods.
However, then I created beans for the actual classes which makes load the groovy scripts, namely, org.springframework.scripting.support.ScriptFactoryPostProcessor and org.springframework.scripting.groovy.GroovyScriptFactory.
So I implemented the following beans..
And with this definition, these beans do load the groovy scripts at runtime and the URLs are mapped to their respective handler methods. But using this definition, I am unable to implement the 'dynamic bean refresh' functionality. This can be done easily using the refresh-check-delay attribute in the lang:groovy tag.
Juergen Hoeller commented
Does this refer to the same scenario as #10935? In that case, setting proxy-target-class="true" on your lang:groovy tag should help...
Otherwise, target class annotations will not get exposed through the proxy and therefore not discovered by the MVC DispatcherServlet.
venkata narayana commented
Any update on this as I am holding off upgrading my Spring version from 2.5.6 (this feature works on this version) to the latest and Java from 1.7 to 1.8.
I recently tested on 5.0.8.RELEASE and no luck. I tried all the attribute combinations as per the doc:(
<lang:groovy id="nnService" script-source="classpath:com/vnn/apps/reload/ServiceImpl.groovy" scope="prototype" proxy-target-class="true" refresh-check-delay="1000"/>