它是否只扫描控制器、服务、数据、自动批注?它对RequestMapping、ResponseBody和其他Hibernate有什么影响--注释、行Id、表等。如果在我的项目中,我没有使用任何控制器、服务、dao、自动批注,而只使用RequestMapping、ResponseBody和Hibernate-那么dispatcher xml是否需要使用注释?
发布于 2014-04-24 05:18:08
对于你的场景,答案是否定的。这是样本。由于您没有在Class上添加任何Spring注释,这意味着bean不是由Spring管理的。所以春天不能对它做任何事。hibernate注释也是如此。
对于Context:component-scan,我建议您打开上下文模式:http://www.springframework.org/schema/context/spring-context-3.0.xsd,它上有描述。还请注意,对于所有这类配置,请打开模式并检查描述,非常清楚。
发布于 2014-04-24 06:06:07
不,它做的远不止这些。
有关组件扫描的详细说明,请参考参考页中的这些部分作为起点:
http://docs.spring.io/spring/docs/4.0.3.RELEASE/spring-framework-reference/htmlsingle/#beans-annotation-config
http://docs.spring.io/spring/docs/4.0.3.RELEASE/spring-framework-reference/htmlsingle/#beans-classpath-scanning
https://stackoverflow.com/questions/23260132
复制相似问题