基于 XML 的 Spring Security 配置中的 use-expressions 属性等同于基于代码的配置 [英] Equivalent of use-expressions attribute in XML based Spring Security configuration to code based configuration

查看:36
本文介绍了基于 XML 的 Spring Security 配置中的 use-expressions 属性等同于基于代码的配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在基于代码的配置中启用 Spring Security 配置的 use-expressions 选项?需要此选项才能启用 基于表达式的访问控制 用法.

How to enable the use-expressions option of the Spring Security configuration in a code based configuration? This option is needed to enable Expression-Based Access Control usage for Thymeleaf.

在 XML 配置中它看起来像这样:

In the XML configuration it looks like this:

...
<http auto-config="true" use-expressions="true" >
   ...   
</http>
...

推荐答案

根据 this 博客文章,use-expressions 在使用 Java 配置时设置为 true.

According to this blog post, use-expressions is set to true when using the Java Configuration.

Comparison to XML Namespace
...
One difference is that Java Configuration uses authorizeUrls 
to specify use-expressions="true"

希望这会有所帮助.

这篇关于基于 XML 的 Spring Security 配置中的 use-expressions 属性等同于基于代码的配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆