提交 | 用户 | age
|
566411
|
1 |
package com.hx.other.service.config; |
G |
2 |
|
|
3 |
import org.springframework.beans.factory.annotation.Qualifier; |
|
4 |
import org.springframework.context.annotation.Bean; |
|
5 |
import org.springframework.context.annotation.Configuration; |
|
6 |
import org.springframework.jdbc.core.JdbcTemplate; |
|
7 |
|
|
8 |
import javax.sql.DataSource; |
|
9 |
|
|
10 |
/** |
|
11 |
* jdbc数据源配置 |
|
12 |
* @Author: cmg |
|
13 |
* @Date: 2023/5/5 10:59 |
|
14 |
*/ |
|
15 |
@Configuration |
|
16 |
public class JdbcTemplateConfig { |
|
17 |
|
|
18 |
@Bean(name = "readJdbcTemplate") |
|
19 |
public JdbcTemplate readJdbTemplate(@Qualifier("readDataSource") DataSource dataSource) |
|
20 |
{ |
|
21 |
return new JdbcTemplate(dataSource); |
|
22 |
} |
|
23 |
} |