本文共 1188 字,大约阅读时间需要 3 分钟。
package com.dao;public class person { private String name; private Integer age; public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge(int i) { return age; } public void setAge(Integer age) { this.age = age; }}
package com.liwen;import com.dao.person;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class HellCotroller { @RequestMapping("/hello") public String Hello() { return "liwen good!"; } @RequestMapping("/person") public person getPerson() { person per = new person(); per.setAge(22); per.setName("李玟"); return per; }}
package com.liwen;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublic class Appmin { public static void main(String[] args) { SpringApplication.run(Appmin.class,args); }}
转载于:https://blog.51cto.com/357712148/2126585