Skip to content

Commit

Permalink
Sets defaults of StoreTypes in getters of TlsProperties.
Browse files Browse the repository at this point in the history
Deprecates TlsProperties.postConstruct
  • Loading branch information
spencergibb committed Mar 15, 2021
1 parent cf21ea8 commit 483f4a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.util.HashMap;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.springframework.core.io.Resource;

/**
Expand Down Expand Up @@ -76,6 +74,9 @@ public void setKeyStore(Resource keyStore) {
}

public String getKeyStoreType() {
if (keyStore != null && keyStoreType == null) {
keyStoreType = storeTypeOf(keyStore);
}
return keyStoreType;
}

Expand Down Expand Up @@ -116,6 +117,9 @@ public void setTrustStore(Resource trustStore) {
}

public String getTrustStoreType() {
if (trustStore != null && trustStoreType == null) {
trustStoreType = storeTypeOf(trustStore);
}
return trustStoreType;
}

Expand All @@ -135,14 +139,8 @@ public char[] trustStorePassword() {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ public void createProperties() {
properties.setKeyPassword(KEY_PASSWORD);
properties.setTrustStore(resourceOf(trustStore));
properties.setTrustStorePassword(KEY_STORE_PASSWORD);

properties.postConstruct();
}

private Resource resourceOf(File file) {
Expand Down

0 comments on commit 483f4a6

Please sign in to comment.