Skip to content

Commit 154ef8b

Browse files
committed
Polishing
1 parent 9005481 commit 154ef8b

File tree

5 files changed

+40
-32
lines changed

5 files changed

+40
-32
lines changed

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -69,6 +69,23 @@ public static AbstractBeanDefinition createBeanDefinition(
6969
return bd;
7070
}
7171

72+
/**
73+
* Generate a bean name for the given top-level bean definition,
74+
* unique within the given bean factory.
75+
* @param beanDefinition the bean definition to generate a bean name for
76+
* @param registry the bean factory that the definition is going to be
77+
* registered with (to check for existing bean names)
78+
* @return the generated bean name
79+
* @throws BeanDefinitionStoreException if no unique name can be generated
80+
* for the given bean definition
81+
* @see #generateBeanName(BeanDefinition, BeanDefinitionRegistry, boolean)
82+
*/
83+
public static String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry registry)
84+
throws BeanDefinitionStoreException {
85+
86+
return generateBeanName(beanDefinition, registry, false);
87+
}
88+
7289
/**
7390
* Generate a bean name for the given bean definition, unique within the
7491
* given bean factory.
@@ -117,22 +134,6 @@ else if (definition.getFactoryBeanName() != null) {
117134
return id;
118135
}
119136

120-
/**
121-
* Generate a bean name for the given top-level bean definition,
122-
* unique within the given bean factory.
123-
* @param beanDefinition the bean definition to generate a bean name for
124-
* @param registry the bean factory that the definition is going to be
125-
* registered with (to check for existing bean names)
126-
* @return the generated bean name
127-
* @throws BeanDefinitionStoreException if no unique name can be generated
128-
* for the given bean definition
129-
*/
130-
public static String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry registry)
131-
throws BeanDefinitionStoreException {
132-
133-
return generateBeanName(beanDefinition, registry, false);
134-
}
135-
136137
/**
137138
* Register the given bean definition with the given bean factory.
138139
* @param definitionHolder the bean definition including name and aliases

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,22 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
5454
* Name of the ConversionService bean in the factory.
5555
* If none is supplied, default conversion rules apply.
5656
* @see org.springframework.core.convert.ConversionService
57+
* @since 3.0
5758
*/
5859
String CONVERSION_SERVICE_BEAN_NAME = "conversionService";
5960

6061
/**
6162
* Name of the LoadTimeWeaver bean in the factory. If such a bean is supplied,
6263
* the context will use a temporary ClassLoader for type matching, in order
6364
* to allow the LoadTimeWeaver to process all actual bean classes.
65+
* @since 2.5
6466
* @see org.springframework.instrument.classloading.LoadTimeWeaver
6567
*/
6668
String LOAD_TIME_WEAVER_BEAN_NAME = "loadTimeWeaver";
6769

6870
/**
6971
* Name of the {@link Environment} bean in the factory.
72+
* @since 3.1
7073
*/
7174
String ENVIRONMENT_BEAN_NAME = "environment";
7275

@@ -85,6 +88,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
8588

8689
/**
8790
* Set the unique id of this application context.
91+
* @since 3.0
8892
*/
8993
void setId(String id);
9094

@@ -100,13 +104,15 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
100104

101105
/**
102106
* Return the Environment for this application context in configurable form.
107+
* @since 3.1
103108
*/
104109
@Override
105110
ConfigurableEnvironment getEnvironment();
106111

107112
/**
108113
* Set the {@code Environment} for this application context.
109114
* @param environment the new environment
115+
* @since 3.1
110116
*/
111117
void setEnvironment(ConfigurableEnvironment environment);
112118

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ public void setId(String id) {
160160
* Set whether it should be allowed to override bean definitions by registering
161161
* a different definition with the same name, automatically replacing the former.
162162
* If not, an exception will be thrown. Default is "true".
163+
* @since 3.0
163164
* @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowBeanDefinitionOverriding
164165
*/
165166
public void setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverriding) {
@@ -171,6 +172,7 @@ public void setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverridi
171172
* try to resolve them.
172173
* <p>Default is "true". Turn this off to throw an exception when encountering
173174
* a circular reference, disallowing them completely.
175+
* @since 3.0
174176
* @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowCircularReferences
175177
*/
176178
public void setAllowCircularReferences(boolean allowCircularReferences) {

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,24 +35,24 @@
3535
*
3636
* <h4>Example: adding a new property source with highest search priority</h4>
3737
* <pre class="code">
38-
* ConfigurableEnvironment environment = new StandardEnvironment();
39-
* MutablePropertySources propertySources = environment.getPropertySources();
40-
* Map<String, String> myMap = new HashMap<String, String>();
41-
* myMap.put("xyz", "myValue");
42-
* propertySources.addFirst(new MapPropertySource("MY_MAP", myMap));
38+
* ConfigurableEnvironment environment = new StandardEnvironment();
39+
* MutablePropertySources propertySources = environment.getPropertySources();
40+
* Map<String, String> myMap = new HashMap<String, String>();
41+
* myMap.put("xyz", "myValue");
42+
* propertySources.addFirst(new MapPropertySource("MY_MAP", myMap));
4343
* </pre>
4444
*
4545
* <h4>Example: removing the default system properties property source</h4>
4646
* <pre class="code">
47-
* MutablePropertySources propertySources = environment.getPropertySources();
48-
* propertySources.remove(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)
47+
* MutablePropertySources propertySources = environment.getPropertySources();
48+
* propertySources.remove(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)
4949
* </pre>
5050
*
5151
* <h4>Example: mocking the system environment for testing purposes</h4>
5252
* <pre class="code">
53-
* MutablePropertySources propertySources = environment.getPropertySources();
54-
* MockPropertySource mockEnvVars = new MockPropertySource().withProperty("xyz", "myValue");
55-
* propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, mockEnvVars);
53+
* MutablePropertySources propertySources = environment.getPropertySources();
54+
* MockPropertySource mockEnvVars = new MockPropertySource().withProperty("xyz", "myValue");
55+
* propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, mockEnvVars);
5656
* </pre>
5757
*
5858
* When an {@link Environment} is being used by an {@code ApplicationContext}, it is
@@ -64,7 +64,6 @@
6464
* org.springframework.context.support.PropertySourcesPlaceholderConfigurer property
6565
* placeholder configurers}.
6666
*
67-
*
6867
* @author Chris Beams
6968
* @since 3.1
7069
* @see StandardEnvironment

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -77,8 +77,8 @@ public interface Environment extends PropertyResolver {
7777
* activated by setting {@linkplain AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME
7878
* "spring.profiles.active"} as a system property or by calling
7979
* {@link ConfigurableEnvironment#setActiveProfiles(String...)}.
80-
* <p>If no profiles have explicitly been specified as active, then any {@linkplain
81-
* #getDefaultProfiles() default profiles} will automatically be activated.
80+
* <p>If no profiles have explicitly been specified as active, then any
81+
* {@linkplain #getDefaultProfiles() default profiles} will automatically be activated.
8282
* @see #getDefaultProfiles
8383
* @see ConfigurableEnvironment#setActiveProfiles
8484
* @see AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME

0 commit comments

Comments
 (0)