Appears to be a continuation of https://github.com/spring-projects/spring-framework/issues/14886
Consider a endpoint in a groovy file such as:
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
import javax.servlet.http.HttpServletRequest
@RestController
class TestController {
@GetMapping(value = "/test")
String handler(HttpServletRequest request) {
return "success"
}
}
and using a beans config file such as:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang https://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<!-- https://docs.spring.io/spring-framework/docs/current/reference/html/languages.html#groovy-->
<lang:defaults refresh-check-delay="1000"/>
<lang:groovy id="myCustomEndpoint" script-source="file:../MyCustomEndpoint.groovy" proxy-target-class="true"/>
</beans>
In order for the controller to get registered the beans seems to require the proxy-target-class="true"
configuration. But when you use the proxy-target-class configuration this breaks the ability to refresh the bean.
Comment From: StephenOTT
Also related: https://github.com/spring-projects/spring-framework/issues/15317
Comment From: snicoll
But when you use the proxy-target-class configuration this breaks the ability to refresh the bean.
What do you mean by that. Can you please clarify? Sharing a small sample we can run ourselves would be ideal.
Comment From: StephenOTT
@snicoll the feature of <lang:defaults refresh-check-delay="1000"/>
where the bean is "refreshed" based on code changes at runtime does not work when using the proxy setting and the proxy setting was required to get the Rest controller to appear.
Is this feature still part of core supported features? Seems it to be very old at this point.
Comment From: snicoll
What "does not work" mean is what I am trying to get at.
Is this feature still part of core supported features? Seems it to be very old at this point.
It is old yes and hasn't been touched in years.
Comment From: StephenOTT
From memory (it has been a few years) i believe it throws an error about unable to locate the proxy. "Does not work" means an error occurs when the groovy code is updated at runtime
Comment From: jhoeller
Since we are phasing out that dynamic scripting arrangement, I do not see us revisiting the interaction between proxies and runtime refreshes here. I'm afraid it is what it is at this point and we'll just sustain it for a little longer.