81,092
社区成员
发帖
与我相关
我的任务
分享
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DruidTestController {
private static final Logger logger = LoggerFactory.getLogger(DruidTestController.class);
@Autowired
private JdbcTemplate jdbcTemplate;
@RequestMapping("hello")
public List<Map<String, Object>> hello() {
List<Map<String, Object>> list = jdbcTemplate.queryForList("SELECT user,password FROM myblog.user ", new Object[]{});
logger.info("查询用户信息。。。。。。。。。。");
return list;
}
}