色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

boot中自定義dispatchServlet的訪問路徑

林國瑞2年前15瀏覽0評論

boot中自定義dispatchServlet的訪問路徑?

在程序的主入口中定義dispatchRegistration

package com.lzl;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.boot.web.servlet.ServletComponentScan;

import org.springframework.boot.web.servlet.ServletRegistrationBean;

import org.springframework.context.annotation.Bean;

import org.springframework.web.servlet.DispatcherServlet;

import com.lzl.servlet.MyServlet;

@SpringBootApplication

public class SpringBootDemoApplication {

public static void main(String[] args) {

SpringApplication.run(SpringBootDemoApplication.class, args);

}

@Bean

public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {

ServletRegistrationBean reg = new ServletRegistrationBean(dispatcherServlet);

reg.getUrlMappings().clear();

reg.addUrlMappings("*.html");

reg.addUrlMappings("*.do");

return reg;

}

}