I’m writing web application that uses Spring MVC to bind Spring beans with REST-like channels.
I’ve created the configuration basic both on my previous apps (pure XML configuration) and example, which used <mvc:annotation-driven/> feature. I’m pointing a package with controllers with <context:component-scan base-package="my.package"/> in spring xml file.
It is working – in Spring 3.0.6.RELEASE. However, after upgrading to 3.1.0.RELEASE my controllers stopped to be detected and no channel was registered. Spring context contains no implementation of HelloChannel interface.
Is this a bug in this Spring version, or I’m using deprecated configuration, which stopped to be supported in newer version? I got no error or warning, simply no bean is auto-detected.
The controller interface definition looks like that:
@RequestMapping("/config") public interface ConfigChannel
And the implementation:
@Controller
public class ConfigChannelImpl implements ConfigChannel
The Spring documentation indicates that interface-based
@Controllers are for proxying transactional methods. As such, you are probably using the<tx:annotation-driven />tag. The problem you now seem to have is that Spring 3.1 introduced support for CGLIB, a runtime-based bytecode manipulator. You need to addproxy-target-class="true"to your transaction configuration and add CGLIB to your classpath.From http://static.springsource.org/spring/docs/3.1.0.M1/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping