首页>代码>spring boot+mybatis+mysql项目搭建入门实例>/springbootdemo/src/main/java/cn/wmyskxz/springboot/HelloController.java
package cn.wmyskxz.springboot; /** * Created by Administrator on 2018/7/6. */ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Date; @Controller public class HelloController { @Autowired private StudentPropertise studentPropertise; @RequestMapping("/hello") @ResponseBody public String hello() { return "Hello Spring Boot!"; } @RequestMapping("/stuinfo") @ResponseBody public String stuinfo() { return studentPropertise.getName()+"---+++"+studentPropertise.getAge(); } @RequestMapping("/now") public String now(Model model) { model.addAttribute("time",new Date()); return "now"; } }