@@ -24,8 +24,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
|
||||
/**
|
||||
* Autoconfiguration for some MVC endpoints governing the application context lifecycle.
|
||||
* Provides restart, pause, resume, refresh (environment) and environment update
|
||||
* Auto-configuration for some MVC endpoints governing the application context lifecycle.
|
||||
* Provides restart, pause, resume, refresh (environment), and environment update
|
||||
* endpoints.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
|
||||
public @interface BootstrapConfiguration {
|
||||
|
||||
/**
|
||||
* Exclude specific auto-configuration classes such that they will never be applied.
|
||||
* Excludes specific auto-configuration classes such that they will never be applied.
|
||||
*/
|
||||
Class<?>[] exclude() default {};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class PropertySourceBootstrapProperties {
|
||||
|
||||
/**
|
||||
* Flag to indicate that when {@link #setAllowOverride(boolean) allowOverride} is
|
||||
* true, external properties should take lowest priority, and not override any
|
||||
* true, external properties should take lowest priority and should not override any
|
||||
* existing property sources (including local config files). Default false.
|
||||
*/
|
||||
private boolean overrideNone = false;
|
||||
|
||||
@@ -29,10 +29,10 @@ import org.springframework.core.env.PropertySource;
|
||||
public interface PropertySourceLocator {
|
||||
|
||||
/**
|
||||
* @param environment the current Environment
|
||||
* @return a PropertySource or null if there is none
|
||||
* @param environment The current Environment.
|
||||
* @return A PropertySource, or null if there is none.
|
||||
*
|
||||
* @throws IllegalStateException if there is a fail fast condition
|
||||
* @throws IllegalStateException if there is a fail-fast condition.
|
||||
*/
|
||||
PropertySource<?> locate(Environment environment);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.core.env.SystemEnvironmentPropertySource;
|
||||
import org.springframework.security.crypto.encrypt.TextEncryptor;
|
||||
|
||||
/**
|
||||
* Decrypt properties from the environment and insert them with high priority so they
|
||||
* Decrypts properties from the environment and inserts them with high priority so they
|
||||
* override the encrypted values.
|
||||
*
|
||||
* @author Dave Syer
|
||||
@@ -67,7 +67,7 @@ public class EnvironmentDecryptApplicationInitializer implements
|
||||
/**
|
||||
* Strategy to determine how to handle exceptions during decryption.
|
||||
*
|
||||
* @param failOnError the flag value (default true)
|
||||
* @param failOnError The flag value (default true).
|
||||
*/
|
||||
public void setFailOnError(boolean failOnError) {
|
||||
this.failOnError = failOnError;
|
||||
|
||||
@@ -22,13 +22,13 @@ import org.springframework.core.io.Resource;
|
||||
public class KeyProperties {
|
||||
|
||||
/**
|
||||
* A symmetric key. As a stronger alternative consider using a keystore.
|
||||
* A symmetric key. As a stronger alternative, consider using a keystore.
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* A salt for the symmetric key in the form of a hex-encoded byte array. As a stronger
|
||||
* alternative consider using a keystore.
|
||||
* A salt for the symmetric key, in the form of a hex-encoded byte array. As a stronger
|
||||
* alternative, consider using a keystore.
|
||||
*/
|
||||
private String salt = "deadbeef";
|
||||
|
||||
@@ -131,4 +131,4 @@ public class KeyProperties {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,22 +27,22 @@ import org.springframework.security.rsa.crypto.RsaAlgorithm;
|
||||
public class RsaProperties {
|
||||
|
||||
/**
|
||||
* The RSA algorithm to use (DEFAULT or OEAP). Once it is set do not change it (or
|
||||
* existing ciphers will not a decryptable).
|
||||
* The RSA algorithm to use (DEFAULT or OEAP). Once it is set, do not change it (or
|
||||
* existing ciphers will not be decryptable).
|
||||
*/
|
||||
private RsaAlgorithm algorithm = RsaAlgorithm.DEFAULT;
|
||||
|
||||
/**
|
||||
* Flag to indicate that "strong" AES encryption should be used internally. If
|
||||
* true then the GCM algorithm is applied to the AES encrypted bytes. Default is
|
||||
* false (in which case "standard" CBC is used instead). Once it is set do not
|
||||
* change it (or existing ciphers will not a decryptable).
|
||||
* true, then the GCM algorithm is applied to the AES encrypted bytes. Default is
|
||||
* false (in which case "standard" CBC is used instead). Once it is set, do not
|
||||
* change it (or existing ciphers will not be decryptable).
|
||||
*/
|
||||
private boolean strong = false;
|
||||
|
||||
/**
|
||||
* Salt for the random secret used to encrypt cipher text. Once it is set do not
|
||||
* change it (or existing ciphers will not a decryptable).
|
||||
* Salt for the random secret used to encrypt cipher text. Once it is set, do not
|
||||
* change it (or existing ciphers will not be decryptable).
|
||||
*/
|
||||
private String salt = "deadbeef";
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class EnvironmentChangeEvent extends ApplicationEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the keys
|
||||
* @return The keys.
|
||||
*/
|
||||
public Set<String> getKeys() {
|
||||
return keys;
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* Entry point for making local (but volatile) changes to the {@link Environment} of a
|
||||
* running application. Allows properties to be added and values changed, simply by adding
|
||||
* them to a high priority property source in the existing Environment.
|
||||
* them to a high-priority property source in the existing Environment.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.boot.actuate.endpoint.web.annotation.EndpointWebExten
|
||||
import org.springframework.boot.actuate.env.EnvironmentEndpointWebExtension;
|
||||
|
||||
/**
|
||||
* MVC endpoint for the {@link EnvironmentManager} providing a POST to /env as a simple
|
||||
* MVC endpoint for the {@link EnvironmentManager}, providing a POST to /env as a simple
|
||||
* way to change the Environment.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -74,7 +74,7 @@ ApplicationContextAware {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param beans the bean meta data to set
|
||||
* @param beans The bean meta data to set.
|
||||
*/
|
||||
public void setBeanMetaDataStore(ConfigurationBeanFactoryMetadata beans) {
|
||||
this.metaData = beans;
|
||||
|
||||
@@ -39,10 +39,10 @@ import org.springframework.cloud.util.ProxyUtils;
|
||||
* Listens for {@link EnvironmentChangeEvent} and rebinds beans that were bound to the
|
||||
* {@link Environment} using {@link ConfigurationProperties
|
||||
* <code>@ConfigurationProperties</code>}. When these beans are re-bound and
|
||||
* re-initialized the changes are available immediately to any component that is using the
|
||||
* re-initialized, the changes are available immediately to any component that is using the
|
||||
* <code>@ConfigurationProperties</code> bean.
|
||||
*
|
||||
* @see RefreshScope for a deeper and optionally more focused refresh of bean components
|
||||
* @see RefreshScope for a deeper and optionally more focused refresh of bean components.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -71,7 +71,7 @@ public class ConfigurationPropertiesRebinder
|
||||
/**
|
||||
* A map of bean name to errors when instantiating the bean.
|
||||
*
|
||||
* @return the errors accumulated since the latest destroy
|
||||
* @return The errors accumulated since the latest destroy.
|
||||
*/
|
||||
public Map<String, Exception> getErrors() {
|
||||
return this.errors;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ContextRefresher {
|
||||
return keys;
|
||||
}
|
||||
|
||||
/* for testing */ ConfigurableApplicationContext addConfigFilesToEnvironment() {
|
||||
/* For testing. */ ConfigurableApplicationContext addConfigFilesToEnvironment() {
|
||||
ConfigurableApplicationContext capture = null;
|
||||
try {
|
||||
StandardEnvironment environment = copyEnvironment(
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.event.SmartApplicationListener;
|
||||
|
||||
/**
|
||||
* A listener that stores enough information about an application as it starts, to be able
|
||||
* A listener that stores enough information about an application, as it starts, to be able
|
||||
* to restart it later if needed.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -91,10 +91,10 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
|
||||
private ConcurrentMap<String, ReadWriteLock> locks = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Manual override for the serialization id that will be used to identify the bean
|
||||
* Manual override for the serialization ID that will be used to identify the bean
|
||||
* factory. The default is a unique key based on the bean names in the bean factory.
|
||||
*
|
||||
* @param id the id to set
|
||||
* @param id The ID to set.
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
@@ -103,7 +103,7 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
|
||||
/**
|
||||
* The name of this scope. Default "generic".
|
||||
*
|
||||
* @param name the name value to set
|
||||
* @param name The name value to set.
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
@@ -112,7 +112,7 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
|
||||
/**
|
||||
* The cache implementation to use for bean instances in this scope.
|
||||
*
|
||||
* @param cache the cache to use
|
||||
* @param cache The cache to use.
|
||||
*/
|
||||
public void setScopeCache(ScopeCache cache) {
|
||||
this.cache = new BeanLifecycleWrapperCache(cache);
|
||||
@@ -121,7 +121,7 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
|
||||
/**
|
||||
* A map of bean name to errors when instantiating the bean.
|
||||
*
|
||||
* @return the errors accumulated since the latest destroy
|
||||
* @return The errors accumulated since the latest destroy.
|
||||
*/
|
||||
public Map<String, Exception> getErrors() {
|
||||
return this.errors;
|
||||
@@ -153,10 +153,10 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the named bean (i.e. flush it from the cache by default).
|
||||
* Destroys the named bean (i.e. flushes it from the cache by default).
|
||||
*
|
||||
* @param name the bean name to flush
|
||||
* @return true if the bean was already cached, false otherwise
|
||||
* @param name The bean name to flush.
|
||||
* @return True if the bean was already cached; false otherwise.
|
||||
*/
|
||||
protected boolean destroy(String name) {
|
||||
BeanLifecycleWrapper wrapper = this.cache.remove(name);
|
||||
@@ -269,13 +269,13 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
|
||||
}
|
||||
|
||||
/**
|
||||
* If the bean factory is a DefaultListableBeanFactory then it can serialize scoped
|
||||
* If the bean factory is a DefaultListableBeanFactory, then it can serialize scoped
|
||||
* beans and deserialize them in another context (even in another JVM), as long as the
|
||||
* ids of the bean factories match. This method sets up the serialization id to be
|
||||
* either the id provided to the scope instance, or if that is null, a hash of all the
|
||||
* IDs of the bean factories match. This method sets up the serialization ID to be
|
||||
* either the ID provided to the scope instance, or if that is null, a hash of all the
|
||||
* bean names.
|
||||
*
|
||||
* @param beanFactory the bean factory to configure
|
||||
* @param beanFactory The bean factory to configure.
|
||||
*/
|
||||
private void setSerializationId(ConfigurableListableBeanFactory beanFactory) {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.context.scope;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A special purpose cache interface specifically for the {@link GenericScope} to use to manage cached bean instances.
|
||||
* A special-purpose cache interface specifically for the {@link GenericScope} to use to manage cached bean instances.
|
||||
* Implementations generally fall into two categories: those that store values "globally" (i.e. one instance per key),
|
||||
* and those that store potentially multiple instances per key based on context (e.g. via a thread local). All
|
||||
* implementations should be thread safe.
|
||||
@@ -30,25 +30,25 @@ import java.util.Collection;
|
||||
public interface ScopeCache {
|
||||
|
||||
/**
|
||||
* Remove the object with this name from the cache.
|
||||
* Removes the object with this name from the cache.
|
||||
*
|
||||
* @param name the object name
|
||||
* @return the object removed or null if there was none
|
||||
* @param name The object name.
|
||||
* @return The object removed, or null if there was none.
|
||||
*/
|
||||
Object remove(String name);
|
||||
|
||||
/**
|
||||
* Clear the cache and return all objects in an unmodifiable collection.
|
||||
* Clears the cache and returns all objects in an unmodifiable collection.
|
||||
*
|
||||
* @return all objects stored in the cache
|
||||
* @return All objects stored in the cache.
|
||||
*/
|
||||
Collection<Object> clear();
|
||||
|
||||
/**
|
||||
* Get the named object from the cache.
|
||||
* Gets the named object from the cache.
|
||||
*
|
||||
* @param name the name of the object
|
||||
* @return the object with that name or null if there is none
|
||||
* @param name The name of the object.
|
||||
* @return The object with that name, or null if there is none.
|
||||
*/
|
||||
Object get(String name);
|
||||
|
||||
@@ -56,9 +56,9 @@ public interface ScopeCache {
|
||||
* Put a value in the cache if the key is not already used. If one is already present with the name provided, it is
|
||||
* not replaced, but is returned to the caller.
|
||||
*
|
||||
* @param name the key
|
||||
* @param value the new candidate value
|
||||
* @return the value that is in the cache at the end of the operation
|
||||
* @param name The key.
|
||||
* @param value The new candidate value.
|
||||
* @return The value that is in the cache at the end of the operation.
|
||||
*/
|
||||
Object put(String name, Object value);
|
||||
|
||||
|
||||
@@ -46,20 +46,20 @@ import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
* proxy for every bean in the scope, so there is a flag
|
||||
* {@link #setProxyTargetClass(boolean) proxyTargetClass} which controls the proxy
|
||||
* creation, defaulting to JDK dynamic proxies and therefore only exposing the interfaces
|
||||
* implemented by a bean. If callers need access to other methods then the flag needs to
|
||||
* be set (and CGLib present on the classpath). Because this scope automatically proxies
|
||||
* all its beans, there is no need to add <code><aop:auto-proxy/></code> to any bean
|
||||
* definitions.
|
||||
* implemented by a bean. If callers need access to other methods, then the flag needs to
|
||||
* be set (and CGLib must be present on the classpath). Because this scope automatically
|
||||
* proxies all its beans, there is no need to add <code><aop:auto-proxy/></code> to
|
||||
* any bean definitions.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The scoped proxy approach adopted here has a side benefit that bean instances are
|
||||
* automatically {@link Serializable}, and can be sent across the wire as long as the
|
||||
* receiver has an identical application context on the other side. To ensure that the two
|
||||
* contexts agree that they are identical they have to have the same serialization id. One
|
||||
* will be generated automatically by default from the bean names, so two contexts with
|
||||
* the same bean names are by default able to exchange beans by name. If you need to
|
||||
* override the default id then provide an explicit {@link #setId(String) id} when the
|
||||
* contexts agree that they are identical, they have to have the same serialization ID.
|
||||
* One will be generated automatically by default from the bean names, so two contexts
|
||||
* with the same bean names are by default able to exchange beans by name. If you need to
|
||||
* override the default ID, then provide an explicit {@link #setId(String) id} when the
|
||||
* Scope is declared.
|
||||
* </p>
|
||||
*
|
||||
@@ -78,7 +78,7 @@ public class RefreshScope extends GenericScope
|
||||
private int order = Ordered.LOWEST_PRECEDENCE - 100;
|
||||
|
||||
/**
|
||||
* Create a scope instance and give it the default name: "refresh".
|
||||
* Creates a scope instance and gives it the default name: "refresh".
|
||||
*/
|
||||
public RefreshScope() {
|
||||
super.setName("refresh");
|
||||
@@ -97,7 +97,7 @@ public class RefreshScope extends GenericScope
|
||||
* Flag to determine whether all beans in refresh scope should be instantiated eagerly
|
||||
* on startup. Default true.
|
||||
*
|
||||
* @param eager the flag to set
|
||||
* @param eager The flag to set.
|
||||
*/
|
||||
public void setEager(boolean eager) {
|
||||
this.eager = eager;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.cloud.context.scope.GenericScope;
|
||||
public class ThreadScope extends GenericScope {
|
||||
|
||||
/**
|
||||
* Create a scope instance and give it the default name: "thread".
|
||||
* Creates a scope instance and gives it the default name: "thread".
|
||||
*/
|
||||
public ThreadScope() {
|
||||
super();
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.springframework.cloud.endpoint.RefreshEndpoint;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* Event that triggers a call to {@link RefreshEndpoint#refresh()}
|
||||
* Event that triggers a call to {@link RefreshEndpoint#refresh()}.
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.context.event.EventListener;
|
||||
|
||||
/**
|
||||
* Calls {@link RefreshEventListener#refresh} when a {@link RefreshEvent} is received.
|
||||
* Only responds to {@link RefreshEvent} after receiving an {@link ApplicationReadyEvent} as the RefreshEvent's might come to early in the application lifecycle.
|
||||
* Only responds to {@link RefreshEvent} after receiving an {@link ApplicationReadyEvent}, as the RefreshEvents might come too early in the application lifecycle.
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
public class RefreshEventListener {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.cloud.context.scope.refresh.RefreshScope;
|
||||
|
||||
/**
|
||||
* Health indicator for the refresh scope and configuration properties rebinding. If an
|
||||
* environment change causes a bean to fail in instantiate or bind this indicator will
|
||||
* environment change causes a bean to fail in instantiate or bind, this indicator will
|
||||
* generally say what the problem was and switch to DOWN.
|
||||
*
|
||||
* @author Dave Syer
|
||||
|
||||
Reference in New Issue
Block a user