SpringBoot让@RequestMapping不能被外界访问只能通过服务期间跳转访问
先讲下原理,SpringBoot拦截请求一般用Interceptor和Filter,而Interceptor是拦截前端控制器dispatcherServlet传递给handler(一个@RequestMapping对应一个handler)的请求,包括服务期间跳转,属于Spring的范畴。而Filter拦截所有外界请求,属于tomcat范畴,不会拦截Spring范畴的服务期间跳转。所以应选Filter作为技术实现方案。下面有测试代码例子:@Controllerpublic class TestCo