Loading

SpringBoot中Utils工具类注入Bean

/**
 * Hive执行器 1:失败 0:成功
 * Created by Ma·JJ on 2021-04-15
 */
@Component
public class HiveConnectUtils {
    @Autowired
    private JdbcTemplate jdbcTemplate;


    public static HiveConnectUtils hiveConnectUtils;

    @PostConstruct
    public void init() {
        hiveConnectUtils = this;
        hiveConnectUtils.jdbcTemplate = this.jdbcTemplate;
    }
}

使用: hiveConnectUtils.jdbcTemplate.execute(hql);

posted @ 2021-05-24 11:41  AnNong  阅读(1137)  评论(0)    收藏  举报