botdetect.xml 中未定义请求的验证码样式“yourFirstCaptchaStyle”

问题描述

我使用带有角度前端和弹簧后端的 angular-captcha。

我完成了 here 定义的所有步骤,但是当我打电话时

my-api-endpoint/simple-captcha-endpoint?get=html&c=yourFirstCaptchaStyle ws

它给了我以下错误

{ "timestamp": "2021-02-08T00:37:14.011+0000","status": 400,"error": "Bad Request","message": "请求的验证码样式 'yourFirstCaptchaStyle' 未在 botdetect.xml 中定义!","path": "//简单验证码端点" }

这是我的 botdetect.xml 文件内容

<?xml version="1.0" encoding="UTF-8"?>
<botdetect xmlns="https://captcha.com/schema/java"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="https://captcha.com/schema/java
             https://captcha.com/schema/java/botdetect-4.0.beta3.7.xsd">

    <captchaStyles>
        <captchaStyle>
            <name>yourFirstCaptchaStyle</name>
            <userInputID>yourFirstCaptchaUserInput</userInputID>
        </captchaStyle>
    </captchaStyles>
</botdetect>

我不知道为什么只在 https 域上工作时出现此错误,而在 http://localhost 上却没有

我错过了什么吗?提前致谢

解决方法

"BDC_configFileLocation","/WEB-INF/classes/botdetect.xml");

路径 /WEB-INF/classes/botdetect.xml 对我有用