Created
May 29, 2018 20:23
-
-
Save jkuipers/237b80f117200e64d5b20fc9d0c6a1ce to your computer and use it in GitHub Desktop.
Type-safe configuration class for the HttpClientAutoConfiguration sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.boot.context.properties.ConfigurationProperties; | |
@ConfigurationProperties("http.client") | |
public class HttpClientProperties { | |
private int connectionTimeoutInMillis = 1_000; | |
private int readTimeoutInMillis = 10_000; | |
/** Used to configure both the default max per route as well as the maximum total connections. */ | |
private int maxConnections = 200; | |
/** | |
* Configures a LoggingClientHttpRequestInterceptor and a BufferingClientHttpRequestFactory, | |
* so requests and responses can be logged. | |
*/ | |
private boolean loggingEnabled; | |
public int getConnectionTimeoutInMillis() { | |
return connectionTimeoutInMillis; | |
} | |
public void setConnectionTimeoutInMillis(int connectionTimeoutInMillis) { | |
this.connectionTimeoutInMillis = connectionTimeoutInMillis; | |
} | |
public int getReadTimeoutInMillis() { | |
return readTimeoutInMillis; | |
} | |
public void setReadTimeoutInMillis(int readTimeoutInMillis) { | |
this.readTimeoutInMillis = readTimeoutInMillis; | |
} | |
public int getMaxConnections() { | |
return maxConnections; | |
} | |
public void setMaxConnections(int maxConnections) { | |
this.maxConnections = maxConnections; | |
} | |
public boolean isLoggingEnabled() { | |
return loggingEnabled; | |
} | |
public void setLoggingEnabled(boolean loggingEnabled) { | |
this.loggingEnabled = loggingEnabled; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment