标签:定义 img 断点 name png text 设置 image drive
1,加入依赖
2,通过自定义配置文件配置数据源信息
3,创建配置类
package com.bdqn.springbootjdbc.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import javax.sql.DataSource;
/*
* 数据源的JDBC配置类
* */
@Configuration
@PropertySource("classpath:/jdbc.properties")//加载指定的jdbc配置文件
public class JdbcConfiguraction {
@Value("${jdbc.driverClassName}")
private String driverClassName;
@Value("${jdbc.url}")
private String url;
@Value("${jdbc.username}")
private String username;
@Value("${jdbc.password}")
private String password;
/*实例化Druid*/
@Bean
public DataSource getDataSource()
{
DruidDataSource source=new DruidDataSource();
source.setDriverClassName(this.driverClassName);
source.setUrl(this.url);
source.setUsername(this.username);
source.setPassword(this.password);
return source;
};
}
4,测试结果 设置断点测试
标签:定义 img 断点 name png text 设置 image drive
原文地址:https://www.cnblogs.com/yz-bky/p/12794990.html