使用工具 -- spring-tool-suite-3.9.8.RELEASE
新建项目:File → New → Project
注意:入口类必须是在最外层,所有子类都得是它下层。
也就是说新增子类包路径得在入口包路径后再新增一层或多层。
如果当前入口类包路径是 com.example.demo
子类包路径则得在此基础上再加一层 com.example.demo.xx
具体测试类内容:
package com.example.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class helloWorld {
@RequestMapping("/helloworld")
public String home(){
return "Hello, Zbook!";
}
}