1、首先是包的依赖

内嵌Tomcat和SpringMVC的简单整合测试

 

 2、添加对外暴露的接口类

package com.fh.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {


    public IndexController(){
        System.out.println("indexController初始化");
    }


    @GetMapping("index")
    @ResponseBody
    public String index(){
        return "index";
    }
}
View Code

相关文章:

  • 2022-01-02
  • 2021-10-14
  • 2022-01-30
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2021-11-15
  • 2021-08-22
  • 2021-06-17
相关资源
相似解决方案