我想在我的SpringBoot应用程序中使用BotDetect Catpcha但不幸的是BotDetect要求我在web.xml上进行Captcha定义。但是我没有web.xml。您是否认为可以在不使用web.xml的情况下在SpringBoot中创建servlet定义?
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>
答案 0 :(得分:1)
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new CaptchaServlet());
registration.setUrlMappings(Arrays.asList("/botdetectcaptcha"));
return registration;
}
SpringBoot应用程序类