@Slf4j
@RequiredArgsConstructor
@Configuration
public class SslConfig {

    private final SslSettings sslSettings;

    @PostConstruct
    void init() {
        String truststore = sslSettings.getTruststore();
        if (truststore != null) {
            log.info("Setting truststore: {}", truststore);
            System.setProperty("javax.net.ssl.trustStore", truststore);
        } else if (System.getProperty("javax.net.ssl.trustStore") != null) {
            log.info("Using provided truststore: {}", System.getProperty("javax.net.ssl.trustStore"));
        } else {
            throw new IllegalStateException("No truststore found!");
        }
    }
}

0 Responses to " ":