<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=szczepan.kuzniarz" rel="nofollow">Szczepan Kuzniarz</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6268?redirect=false" rel="nofollow">SPR-6268</a></strong> and commented</p>
<p dir="auto">In the following example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="package test
@Controller
class TestController {
    @RequestMapping(value = &quot;/testGroovy.do&quot;, method = RequestMethod.GET)
    public String handler(HttpServletRequest request) {
        return &quot;success&quot;
    }
}"><pre class="notranslate"><code class="notranslate">package test
@Controller
class TestController {
    @RequestMapping(value = "/testGroovy.do", method = RequestMethod.GET)
    public String handler(HttpServletRequest request) {
        return "success"
    }
}
</code></pre></div>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;context:annotation-config/&gt;
&lt;context:component-scan base-package=&quot;test&quot;/&gt;
&lt;lang:groovy script-source=&quot;classpath:test/TestController.groovy&quot; refresh-check-delay=&quot;1000&quot;/&gt;"><pre class="notranslate">&lt;<span class="pl-ent">context</span><span class="pl-ent">:</span><span class="pl-ent">annotation-config</span>/&gt;
&lt;<span class="pl-ent">context</span><span class="pl-ent">:</span><span class="pl-ent">component-scan</span> <span class="pl-e">base-package</span>=<span class="pl-s"><span class="pl-pds">"</span>test<span class="pl-pds">"</span></span>/&gt;
&lt;<span class="pl-ent">lang</span><span class="pl-ent">:</span><span class="pl-ent">groovy</span> <span class="pl-e">script-source</span>=<span class="pl-s"><span class="pl-pds">"</span>classpath:test/TestController.groovy<span class="pl-pds">"</span></span> <span class="pl-e">refresh-check-delay</span>=<span class="pl-s"><span class="pl-pds">"</span>1000<span class="pl-pds">"</span></span>/&gt;</pre></div>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;servlet&gt;
    &lt;servlet-name&gt;test&lt;/servlet-name&gt;
    &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
&lt;/servlet&gt;
&lt;servlet-mapping&gt;
    &lt;servlet-name&gt;test&lt;/servlet-name&gt;
    &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;"><pre class="notranslate">&lt;<span class="pl-ent">servlet</span>&gt;
    &lt;<span class="pl-ent">servlet-name</span>&gt;test&lt;/<span class="pl-ent">servlet-name</span>&gt;
    &lt;<span class="pl-ent">servlet-class</span>&gt;org.springframework.web.servlet.DispatcherServlet&lt;/<span class="pl-ent">servlet-class</span>&gt;
&lt;/<span class="pl-ent">servlet</span>&gt;
&lt;<span class="pl-ent">servlet-mapping</span>&gt;
    &lt;<span class="pl-ent">servlet-name</span>&gt;test&lt;/<span class="pl-ent">servlet-name</span>&gt;
    &lt;<span class="pl-ent">url-pattern</span>&gt;*.do&lt;/<span class="pl-ent">url-pattern</span>&gt;
&lt;/<span class="pl-ent">servlet-mapping</span>&gt;</pre></div>
<p dir="auto">DefaultAnnotationHandlerMapping class discovers the Groovy controller and registers a handler as it logs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INFO: Mapped URL path [/testGroovy.do] onto handler [test.TestController@134237]"><pre class="notranslate"><code class="notranslate">INFO: Mapped URL path [/testGroovy.do] onto handler [test.TestController@134237]
</code></pre></div>
<p dir="auto">but accessing such a controller causes ServletException:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="javax.servlet.ServletException: No adapter for handler [test.TestController@134237]: Does your handler implement a supported interface like Controller?
    org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:992)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:780)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:726)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:636)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:545)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"><pre class="notranslate"><code class="notranslate">javax.servlet.ServletException: No adapter for handler [test.TestController@134237]: Does your handler implement a supported interface like Controller?
    org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:992)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:780)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:726)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:636)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:545)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
</code></pre></div>
<p dir="auto">I'm not 100% sure, but it seems AnnotationMethodHandlerAdapter.getMethodResolver is unable to determine proper type of the handler. It uses ClassUtils.getUserClass (which returns proxy as a type) but for Groovy script the right type is it's MetaClass (getMethodResolver should use something like ((groovy.lang.GroovyObject) handler).getMetaClass().getTheClass()).</p>
<p dir="auto">Maybe the problem with Groovy scripts is more general, and not limited to a MVC controller case?</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 RC1</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398159880" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/15317" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/15317/hovercard" href="https://github.com/spring-projects/spring-framework/issues/15317">#15317</a> lang:groovy tag in version 2.5 and higher doesn't work for refreshable Spring MVC endpoints</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398094989" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10419" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10419/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10419">#10419</a> AspectJ pointcut advisors are not working with Groovy script beans</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/64fd0b081d9367a764b88f1894f3f92198e85b07/hovercard" href="https://github.com/spring-projects/spring-framework/commit/64fd0b081d9367a764b88f1894f3f92198e85b07"><tt>64fd0b0</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/8e357348562774952a75e414a66377c4898a28dd/hovercard" href="https://github.com/spring-projects/spring-framework/commit/8e357348562774952a75e414a66377c4898a28dd"><tt>8e35734</tt></a></p>
<p dir="auto">1 votes, 4 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=nvnaresh" rel="nofollow">Naresh Narayana</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-5749?redirect=false" rel="nofollow">SPR-5749</a></strong>* and commented</p>
<p dir="auto">It seems that AOP is not working for Groovy beans.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.6</p>
<p dir="auto"><strong>Reference URL:</strong> <a href="http://forum.springsource.org/showthread.php?t=71389" rel="nofollow">http://forum.springsource.org/showthread.php?t=71389</a></p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/15381/testProject.zip" rel="nofollow">testProject.zip</a> (<em>10.75 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398098642" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10935" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10935/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10935">#10935</a> Annotated Groovy controllers don't work properly</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/bd0f68d095ba881621b8499925334de38a6b1051/hovercard" href="https://github.com/spring-projects/spring-framework/commit/bd0f68d095ba881621b8499925334de38a6b1051"><tt>bd0f68d</tt></a></p>
<p dir="auto">1 votes, 3 watchers</p>