spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/sms?serverTimezone=UTC
username: root
password: 123123
JdbcTemplate:https://www.cnblogs.com/caoyc/p/5630622.html
通过
JdbcTemplate 来进行数据库操作
@Controller
public class HelloController {
@Autowired
JdbcTemplate jdbcTemplate;
@ResponseBody
@RequestMapping("/query")
public List<Map<String, Object>> map() {
// System.out.println("进到了controller");
List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from jduser");
// System.out.println(list);
return list;
}
}
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/sms?serverTimezone=UTC
username: root
password: 123123