// 我使用的最新版Springboot2.3.0(放弃1版本)启动后,不放心的话可以测试数据库是否连接正常
UserMapper userMapper = applicationContext.getBean(UserMapper.class);
Example example = new Example(User.class);
example.createCriteria().andEqualTo("username", "dongguangming");
List<User> userList = userMapper.selectByExample(example);
if (userList.size() > 0) {
User user = userList.get(0);
logger.info("数据库连接正常,从用户表取用户名是donggguangming的数据,用户:" + user);
}