package com.example.jeeboot.user.controller;
import com.example.jeeboot.user.bean.User;
import com.example.jeeboot.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.sql.DataSource;
import java.util.List;
@RestController
public class UserController {
@Autowired
private DataSource druidDataSource;
@Autowired
private UserService userService;
@RequestMapping("/")
private void test(){
System.out.println("asdfasdfasdf");
System.out.println(druidDataSource);
}
@RequestMapping("list")
@ResponseBody
private List<User> list(){
List<User> list =userService.findList();
for (User user :list){
System.out.println(user);
}
return list;
}
}
评论0
最新资源