我在 Spring MVC 中很新,我有以下问题。
在我正在处理的应用程序中,我将 2 个控制器类声明到两个不同的包中。
所以我试图在我的 XML 配置中指定必须由组件扫描设置扫描的第二个包。
因此,如果我只有这个设置可以正常工作(但我只扫描一个包):
<context:component-scan base-package="it.mycompmany.myproject.registrazione"></context:component-scan>
但是如果我尝试指定必须扫描两个不同的包,这样:
<!-- Controller -->
<context:component-scan base-package="it.mycompmany.myproject.registrazione">
</context:component-scan>
<context:component-scan base-package="it.mycompmany.myproject.login>
</context:component-scan>
Eclipse 在第二个组件扫描设置标签上给我错误:
The value of attribute "base-package" associated with an element type "context:component-scan" must not contain the '<' character.
问题是什么?如何正确指定我必须扫描两个不同的包?我错过了什么?