Sets defaults of StoreTypes in getters of TlsProperties.
Deprecates TlsProperties.postConstruct
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user