开发者

How to enable Spring Security Annotations not using app-Context.xml file?

开发者 https://www.devze.com 2023-04-07 20:31 出处:网络
I\'ve implemented my Application using SecurityContextImpl as SecurityContext. anything works well (Authentication and Authorization).

I've implemented my Application using SecurityContextImpl as SecurityContext. anything works well (Authentication and Authorization).

Now I want to use Spring Security Annotation开发者_JS百科s (@Secured , ...) , I my searched result in a single comment :"USE in your context.xml file"

is there any other way to embed security annotations using non-file-based ContextImpls?


Here's the config snippet you need. Not sure why you don't want to enable via 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消