diff --git a/src/main/java/com/sixteam/irs/controller/UserController.java b/src/main/java/com/sixteam/irs/controller/UserController.java index 3f147b8b429245b739584977a6b2cbea369a262b..bff6ae9afe823d6643f6922db56ac212e675b658 100644 --- a/src/main/java/com/sixteam/irs/controller/UserController.java +++ b/src/main/java/com/sixteam/irs/controller/UserController.java @@ -6,15 +6,13 @@ import com.sixteam.irs.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.List; -@Controller +@RestController @CrossOrigin @RequestMapping("/") public class UserController { @@ -23,12 +21,23 @@ public class UserController { private UserService userService; @RequestMapping("/test") - @ResponseBody public List test(){ List userList = userService.findAllUser(); return userList; } + @RequestMapping("/testLogin") + public User testLogin(User user){ + if(user!=null) + { + System.out.println("登陆测试成功!"); + } + User u=userService.findById("114514"); + return u; + } + + + @RequestMapping("/") public String start(){ System.out.println("启动"); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 986aa49e6e1bf98891c6cb533d08b56337d67917..b138cd666b506549ae52304015a972398b8f4a9f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,7 +4,7 @@ spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://49.232.158.16:3306/irs?serverTimezone=UTC - username: irsHCD + username: irsFWQ password: 666 thymeleaf: