spring boot之简单项目搭建

来源:互联网 发布:电脑无线mac地址查询 编辑:程序博客网 时间:2024/06/04 17:54

1.spring-boot-starter-web的引入,其依赖包的学习
2.spring-boot-devtools的引入,其依赖包的学习
3.实现代码
public class User {
private int id;
private String name;
private Date date;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}

package com.drunk.education.controller;

import java.util.Date;
import java.util.HashMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.drunk.education.bean.User;

@RestController
@RequestMapping(value = “/index”)
public class IndexController {
@RequestMapping
public String index() {
return “hello world”;
}
@RequestMapping(value = “/get”)
public HashMap

原创粉丝点击