Spring Boot的特性: 使用JdbcTemplate

[

29.2. 使用JdbcTemplate

Spring的JdbcTemplateNamedParameterJdbcTemplate类会被自动配置,你可以将它们直接@Autowire到自己的beans:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

@Component
public class MyBean {

    private final JdbcTemplate jdbcTemplate;

    @Autowired
    public MyBean(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
    // ...
}

本文来自:Spring Boot的特性:使用JdbcTemplate

 

]
转载请保留页面地址:https://www.breakyizhan.com/springboot/3366.html
原文地址:https://www.cnblogs.com/breakyizhan/p/13257663.html