Sets defaults of StoreTypes in getters of TlsProperties.

Deprecates TlsProperties.postConstruct
This commit is contained in:
spencergibb
2021-03-15 15:56:06 -04:00
parent cf21ea8a65
commit 483f4a69fe
2 changed files with 7 additions and 11 deletions

View File

@@ -20,8 +20,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.core.io.Resource;
/**
@@ -76,6 +74,9 @@ public class TlsProperties {
}
public String getKeyStoreType() {
if (keyStore != null && keyStoreType == null) {
keyStoreType = storeTypeOf(keyStore);
}
return keyStoreType;
}
@@ -116,6 +117,9 @@ public class TlsProperties {
}
public String getTrustStoreType() {
if (trustStore != null && trustStoreType == null) {
trustStoreType = storeTypeOf(trustStore);
}
return trustStoreType;
}
@@ -135,14 +139,8 @@ public class TlsProperties {
return trustStorePassword.toCharArray();
}
@PostConstruct
@Deprecated
public void postConstruct() {
if (keyStore != null && keyStoreType == null) {
keyStoreType = storeTypeOf(keyStore);
}
if (trustStore != null && trustStoreType == null) {
trustStoreType = storeTypeOf(trustStore);
}
}
private String storeTypeOf(Resource resource) {

View File

@@ -92,8 +92,6 @@ public class SSHContextFactoryTests {
properties.setKeyPassword(KEY_PASSWORD);
properties.setTrustStore(resourceOf(trustStore));
properties.setTrustStorePassword(KEY_STORE_PASSWORD);
properties.postConstruct();
}
private Resource resourceOf(File file) {