普通类获取spring的bean对象
解决方法:
假如我想在普通类中获取CustomJdbcTemplate对象
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
throw new RuntimeException("非web请求,非法调用!");
} else {
http://www.yayihouse.com/yayishuwu/chapter/2019
}