Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc 有一种在Stringboot项目中使用BotDetect验证码的方法吗?_Spring Mvc_Spring Boot_Botdetect - Fatal编程技术网

Spring mvc 有一种在Stringboot项目中使用BotDetect验证码的方法吗?

Spring mvc 有一种在Stringboot项目中使用BotDetect验证码的方法吗?,spring-mvc,spring-boot,botdetect,Spring Mvc,Spring Boot,Botdetect,我想在我的SpringBoot应用程序中使用BotDetect Catpcha,但不幸的是,BotDetect要求我在web.xml上定义Captcha。但是我没有web.xml。您认为在SpringBoot上创建servlet定义而不使用web.xml有可能吗 web.xml示例: <servlet> <servlet-name>BotDetect Captcha</servlet-name> <servlet class

我想在我的SpringBoot应用程序中使用BotDetect Catpcha,但不幸的是,BotDetect要求我在web.xml上定义Captcha。但是我没有web.xml。您认为在SpringBoot上创建servlet定义而不使用web.xml有可能吗

web.xml示例:

   <servlet>
      <servlet-name>BotDetect Captcha</servlet-name>
      <servlet class>com.captcha.botdetect.web.servlet.CaptchaServlet</servlet-
   class>
  </servlet>
<servlet-mapping>
<servlet-name>BotDetect Captcha</servlet-name>
 <url-pattern>/botdetectcaptcha</url-pattern>
 </servlet-mapping>

检测验证码
com.captcha.botdetect.web.servlet.CaptchaServlet
检测验证码
/Bottcaptcha
SpringBoot应用程序类

我建议阅读。
web.xml
只是达到目的的一种手段,在本例中是注册servlet。这里唯一的要求是注册servlet,不管如何注册。
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new CaptchaServlet());
    registration.setUrlMappings(Arrays.asList("/botdetectcaptcha"));
    return registration;
}