Consistent use of SCOPE_PROTOTYPE and SCOPE_SINGLETON constants

Closes gh-19905
This commit is contained in:
Sam Brannen
2019-11-24 13:49:43 +01:00
parent 7bed4f36da
commit 59e250c93c
23 changed files with 138 additions and 126 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.Locale;
import org.springframework.beans.BeansException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.lang.Nullable;
@@ -115,7 +116,7 @@ public class StaticApplicationContext extends GenericApplicationContext {
*/
public void registerPrototype(String name, Class<?> clazz) throws BeansException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bd.setBeanClass(clazz);
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
}
@@ -127,7 +128,7 @@ public class StaticApplicationContext extends GenericApplicationContext {
*/
public void registerPrototype(String name, Class<?> clazz, MutablePropertyValues pvs) throws BeansException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
bd.setBeanClass(clazz);
bd.setPropertyValues(pvs);
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);