我已使用SecurityContextImpl
SecurityContext
实施了我的应用。一切运作良好(身份验证和授权)。
现在我想使用Spring Security Annotations(@Secured,...),我的搜索结果只有一个注释:“在context.xml文件中使用”
有没有其他方法可以使用非基于文件的ContextImpls
嵌入安全注释?
答案 0 :(得分:1)
这是您需要的配置代码段。不确定为什么你不想通过XML启用。
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans
xmlns:security="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<security:global-method-security secured-annotations="enabled" />
</beans:beans>