Browse Source

Polishing

pull/1274/head
Juergen Hoeller 9 years ago
parent
commit
154ef8bf10
  1. 35
      spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java
  2. 6
      spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java
  3. 2
      spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java
  4. 3
      spring-core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java
  5. 6
      spring-core/src/main/java/org/springframework/core/env/Environment.java

35
spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -69,6 +69,23 @@ public class BeanDefinitionReaderUtils {
return bd; return bd;
} }
/**
* Generate a bean name for the given top-level bean definition,
* unique within the given bean factory.
* @param beanDefinition the bean definition to generate a bean name for
* @param registry the bean factory that the definition is going to be
* registered with (to check for existing bean names)
* @return the generated bean name
* @throws BeanDefinitionStoreException if no unique name can be generated
* for the given bean definition
* @see #generateBeanName(BeanDefinition, BeanDefinitionRegistry, boolean)
*/
public static String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry registry)
throws BeanDefinitionStoreException {
return generateBeanName(beanDefinition, registry, false);
}
/** /**
* Generate a bean name for the given bean definition, unique within the * Generate a bean name for the given bean definition, unique within the
* given bean factory. * given bean factory.
@ -117,22 +134,6 @@ public class BeanDefinitionReaderUtils {
return id; return id;
} }
/**
* Generate a bean name for the given top-level bean definition,
* unique within the given bean factory.
* @param beanDefinition the bean definition to generate a bean name for
* @param registry the bean factory that the definition is going to be
* registered with (to check for existing bean names)
* @return the generated bean name
* @throws BeanDefinitionStoreException if no unique name can be generated
* for the given bean definition
*/
public static String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry registry)
throws BeanDefinitionStoreException {
return generateBeanName(beanDefinition, registry, false);
}
/** /**
* Register the given bean definition with the given bean factory. * Register the given bean definition with the given bean factory.
* @param definitionHolder the bean definition including name and aliases * @param definitionHolder the bean definition including name and aliases

6
spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java

@ -54,6 +54,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
* Name of the ConversionService bean in the factory. * Name of the ConversionService bean in the factory.
* If none is supplied, default conversion rules apply. * If none is supplied, default conversion rules apply.
* @see org.springframework.core.convert.ConversionService * @see org.springframework.core.convert.ConversionService
* @since 3.0
*/ */
String CONVERSION_SERVICE_BEAN_NAME = "conversionService"; String CONVERSION_SERVICE_BEAN_NAME = "conversionService";
@ -61,12 +62,14 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
* Name of the LoadTimeWeaver bean in the factory. If such a bean is supplied, * Name of the LoadTimeWeaver bean in the factory. If such a bean is supplied,
* the context will use a temporary ClassLoader for type matching, in order * the context will use a temporary ClassLoader for type matching, in order
* to allow the LoadTimeWeaver to process all actual bean classes. * to allow the LoadTimeWeaver to process all actual bean classes.
* @since 2.5
* @see org.springframework.instrument.classloading.LoadTimeWeaver * @see org.springframework.instrument.classloading.LoadTimeWeaver
*/ */
String LOAD_TIME_WEAVER_BEAN_NAME = "loadTimeWeaver"; String LOAD_TIME_WEAVER_BEAN_NAME = "loadTimeWeaver";
/** /**
* Name of the {@link Environment} bean in the factory. * Name of the {@link Environment} bean in the factory.
* @since 3.1
*/ */
String ENVIRONMENT_BEAN_NAME = "environment"; String ENVIRONMENT_BEAN_NAME = "environment";
@ -85,6 +88,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/** /**
* Set the unique id of this application context. * Set the unique id of this application context.
* @since 3.0
*/ */
void setId(String id); void setId(String id);
@ -100,6 +104,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/** /**
* Return the Environment for this application context in configurable form. * Return the Environment for this application context in configurable form.
* @since 3.1
*/ */
@Override @Override
ConfigurableEnvironment getEnvironment(); ConfigurableEnvironment getEnvironment();
@ -107,6 +112,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/** /**
* Set the {@code Environment} for this application context. * Set the {@code Environment} for this application context.
* @param environment the new environment * @param environment the new environment
* @since 3.1
*/ */
void setEnvironment(ConfigurableEnvironment environment); void setEnvironment(ConfigurableEnvironment environment);

2
spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java

@ -160,6 +160,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* Set whether it should be allowed to override bean definitions by registering * Set whether it should be allowed to override bean definitions by registering
* a different definition with the same name, automatically replacing the former. * a different definition with the same name, automatically replacing the former.
* If not, an exception will be thrown. Default is "true". * If not, an exception will be thrown. Default is "true".
* @since 3.0
* @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowBeanDefinitionOverriding * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowBeanDefinitionOverriding
*/ */
public void setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverriding) { public void setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverriding) {
@ -171,6 +172,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* try to resolve them. * try to resolve them.
* <p>Default is "true". Turn this off to throw an exception when encountering * <p>Default is "true". Turn this off to throw an exception when encountering
* a circular reference, disallowing them completely. * a circular reference, disallowing them completely.
* @since 3.0
* @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowCircularReferences * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowCircularReferences
*/ */
public void setAllowCircularReferences(boolean allowCircularReferences) { public void setAllowCircularReferences(boolean allowCircularReferences) {

3
spring-core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java vendored

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,7 +64,6 @@ import java.util.Map;
* org.springframework.context.support.PropertySourcesPlaceholderConfigurer property * org.springframework.context.support.PropertySourcesPlaceholderConfigurer property
* placeholder configurers}. * placeholder configurers}.
* *
*
* @author Chris Beams * @author Chris Beams
* @since 3.1 * @since 3.1
* @see StandardEnvironment * @see StandardEnvironment

6
spring-core/src/main/java/org/springframework/core/env/Environment.java vendored

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -77,8 +77,8 @@ public interface Environment extends PropertyResolver {
* activated by setting {@linkplain AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME * activated by setting {@linkplain AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME
* "spring.profiles.active"} as a system property or by calling * "spring.profiles.active"} as a system property or by calling
* {@link ConfigurableEnvironment#setActiveProfiles(String...)}. * {@link ConfigurableEnvironment#setActiveProfiles(String...)}.
* <p>If no profiles have explicitly been specified as active, then any {@linkplain * <p>If no profiles have explicitly been specified as active, then any
* #getDefaultProfiles() default profiles} will automatically be activated. * {@linkplain #getDefaultProfiles() default profiles} will automatically be activated.
* @see #getDefaultProfiles * @see #getDefaultProfiles
* @see ConfigurableEnvironment#setActiveProfiles * @see ConfigurableEnvironment#setActiveProfiles
* @see AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME * @see AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME

Loading…
Cancel
Save