标签:文件 io ar res ad load ef spring
采用有参数的构造方法来解决注入你要的属性例如:
public MyInvocationSecurityMetadataSource(RoleService roleService) {
this.roleService = roleService;
loadResourceDefine();
}
RoleService 是可以获得资源列表的组件.
在xml配置文件中采用构造函数注入的方式把RoleService 注入到MyInvocationSecurityMetadataSource中.例如
<beans:bean id="securityMetadataSource"
class="com.shoesishow.security.MyInvocationSecurityMetadataSource">
<beans:constructor-arg><beans:ref bean="roleService"/></beans:constructor-arg>
</beans:bean>
spring security 构造函数初始化bean思路,布布扣,bubuko.com
标签:文件 io ar res ad load ef spring
原文地址:http://www.cnblogs.com/simpledev/p/3880646.html