Spring boot 靜態資源設置 二

1、 上文中使用springMvc 的內容

package com.fandong.it.weapon.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {

    @ResponseBody
    @RequestMapping("/hello")
    public String hello(){
        return "hello,spring boot";
    }
}

@Controller  表示是控制器註解

@ResponseBody 表示返回一個json字符串

@RequestMapping 表示求情映射的路徑。

----

靜態資源文件默認路徑

默認是在Resources 文件下

resources/static

resources/META-INF/static

resources/public

--

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章