zhaowenxuan
7 天以前 74ea6779bd941167afcd8c120dc2ac68f886aa67
ltkj-framework/src/main/java/com/ltkj/framework/config/DruidConfig.java
@@ -42,6 +42,7 @@
@Slf4j
public class DruidConfig {
    @Value ("${config.properties}")
    private  String url;
@@ -259,6 +260,7 @@
    }
    @Bean
//    @ConfigurationProperties("spring.datasource.druid.slavepacs")
//    @ConditionalOnProperty(prefix = "spring.datasource.druid.slavepacs", name = "enabled", havingValue = "true")
@@ -276,7 +278,7 @@
            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");
@@ -308,12 +310,13 @@
    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);