133. Spring Boot ServletRegistrationBean从1.3.3到1.4.1的变化【从零开始学Spring Boot】

革命尚未成功,同志仍需努力。继续奋战Spring Boot。活到老,学到老,还有还多没学了。我们只希望当我们需要用到知识的时候,不要书到用时方恨少,每天一丢丢,一年就是一堆堆了。

 

需求缘起:

在录制《Spring Boot Servlet》的视频中,使用到了ServletRegistrationBean这个类进行注册Servlet,发现和原来的1.3.3版本的不一样了。

 

ServletRegistrationBean

主要用来对servlet进行自定义,比如:

   @Bean

    public ServletRegistrationBean myServlet1(){

       returnnew ServletRegistrationBean(new MyServlet1(), "/myServlet1");

    }

 

包名

1.4.0的时候,包名

org.springframework.boot.context.embedded.ServletRegistrationBean

变为了org.springframework.boot.web.servlet. ServletRegistrationBean

需要注意一下。

 

视频&交流平台

à SpringBoot网易云课堂视频

http://study.163.com/course/introduction.htm?courseId=1004329008

à Spring Boot交流平台

http://412887952-qq-com.iteye.com/blog/2321532

 

 

 

 

猜你喜欢

转载自412887952-qq-com.iteye.com/blog/2388462