| | |
| | | @Slf4j |
| | | public class DruidConfig { |
| | | |
| | | |
| | | @Value ("${config.properties}") |
| | | private String url; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Bean |
| | | // @ConfigurationProperties("spring.datasource.druid.slavepacs") |
| | | // @ConditionalOnProperty(prefix = "spring.datasource.druid.slavepacs", name = "enabled", havingValue = "true") |
| | |
| | | props.load(fis); |
| | | fis.close(); |
| | | // 这里是测试写法,具体的value可以通过请求参数传递过来 |
| | | String pacsenabled = props.getProperty("pacsenabled"); |
| | | String pacsenabled = props.getProperty("wsenabled"); |
| | | if (pacsenabled.equals("false")) |
| | | return null; |
| | | String pacsdbtype = props.getProperty("wsdbtype"); |
| | |
| | | |
| | | |
| | | private DruidDataSource creatSqlServer(String enabled, String ip,String port,String db,String user,String password) throws SQLException { |
| | | // -Djdk.tls.client.protocols=TLSv1.2 JVM启动参数 |
| | | DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); |
| | | Properties properties = new Properties(); |
| | | properties.setProperty("druid.enabled", enabled); |
| | | properties.setProperty("druid.driverClassName","com.microsoft.sqlserver.jdbc.SQLServerDriver"); |
| | | properties.setProperty("druid.url","jdbc:sqlserver://"+ ip+":"+ port+";DatabaseName="+ db+ |
| | | ";encrypt=true;trustServerCertificate=true;sslProtocol=TLSv1.2;"); |
| | | ";trustServerCertificate=true;encrypt=false;characterEncoding=utf8"); |
| | | properties.setProperty("druid.username", user); |
| | | properties.setProperty("druid.password", password); |
| | | dataSource.restart(properties); |