1
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import java.security.Security;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
@@ -17,6 +19,7 @@ public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
enableSqlServerLegacyTls();
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("""
|
||||
@@ -24,4 +27,25 @@ public class RuoYiApplication
|
||||
This is a text block with Unicode characters.
|
||||
""");
|
||||
}
|
||||
|
||||
private static void enableSqlServerLegacyTls()
|
||||
{
|
||||
if (!Boolean.parseBoolean(System.getProperty("ruoyi.sqlserver.legacyTls.enabled", "true")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String propertyName = "jdk.tls.disabledAlgorithms";
|
||||
String disabledAlgorithms = Security.getProperty(propertyName);
|
||||
if (disabledAlgorithms == null || disabledAlgorithms.isBlank())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String compatibleAlgorithms = Arrays.stream(disabledAlgorithms.split(","))
|
||||
.map(String::trim)
|
||||
.filter(algorithm -> !"TLSv1".equalsIgnoreCase(algorithm))
|
||||
.collect(Collectors.joining(", "));
|
||||
Security.setProperty(propertyName, compatibleAlgorithms);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user