60,23:23
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starer-web</artifactId>
</dependency>
@RestController
public class HelloController{
@RequestMapping("/hello")
public String hello(){
return "hello,world";
}
} 9
@Controller
@RequestMapping("user")
public class UserController{
@RequestMapping("/index")
public String index(){
map.addAttribute("name","thymeleaf-index");
return "thymeleaf/index";
}
}16
@Controller
public class HelloController{
@RequestMapping("/hello")
@ResponseBody
public String hello(){
return "hello,world";
}
}22
@RestController
@RequestMapping("/user")
public class UserController{
@RequestMapping("/getUser")
public User getUser(){
User u = new User();
u.setName("tianlong");
u.setAge(32);
u.setPassword("lysoft");
return u;
}
}32
@Controller
@RequestMapping("/user")
public class UserController{
@RequestMapping("/getUser")
@ResponseBody
public User getUser(){
User u = new User();
u.setName("tianlong");
u.setAge(20);
u.setPassword("123456");
return u;
}
}43