http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd找不到

问题描述 投票:0回答:1

schema_reference.4: 无法读取架构文档 'http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd',因为 1) 找不到文档; 2)文档无法读取; 3)文档的根元素不是xsd:schema。

这个文件移到哪里了,现在应该指向哪里?

顺便说一句,这个目录是今天刚刚更改的: https://www.springframework.org/schema/security/

spring-security spring-security-oauth2
1个回答
0
投票

找到解决方案。

spring.schemas
文件将
https://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
链接到 spring-security-oauth2.jar 中的
spring-security-oauth2-2.0.xsd
。 该文件在解析 Spring XML 配置期间使用。

所以只需要将schema位置设置为https URL即可:

https://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd

而不是 http URL:

http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd

在您的 XML 配置文件中。

像这个例子的最后两行:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
       xmlns:sec="http://www.springframework.org/schema/security"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security-3.2.xsd
       http://www.springframework.org/schema/security/oauth2
       https://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd">

© www.soinside.com 2019 - 2024. All rights reserved.