拓展CAS服务端的时候有可能会用到依赖注入,只添加
component-scan
配置是不可以的,因为CAS有两个Spring容器所以需要在cas-servlet.xml注册一下,添加以下配置就可以了
<context:annotation-config/>
这个配置特别重要
<context:annotation-config/>
<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
<context:component-scan base-package="com.basepackage">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>