码迷,mamicode.com
首页 > 编程语言 > 详细

Springboot 实现WebMvcConfigurer接口来拓展SpringMvc的功能

时间:2019-05-13 21:32:33      阅读:397      评论:0      收藏:0      [点我收藏+]

标签:not   发送   adapter   oid   删除   pac   color   context   code   

好像是Spring Boot 2.0.4.RELEASEWebMvcConfigurerAdapter已过时,所以想通过继承WebMvcConfigurerAdapter来拓展SpringMvc的功能时会有一条删除线。

因此,通过实现WebMvcConfigurer接口来拓展SpringMvc的功能()

package com.example.springboot.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
    ////浏览器发送 /nihao 请求来到 success registry.addViewController(
"/nihao").setViewName("success"); } }

 

Springboot 实现WebMvcConfigurer接口来拓展SpringMvc的功能

标签:not   发送   adapter   oid   删除   pac   color   context   code   

原文地址:https://www.cnblogs.com/Guhongying/p/10859035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!