Polish "Use constants for well-known scope names"

See gh-43065
This commit is contained in:
Andy Wilkinson
2024-11-08 10:02:28 +00:00
parent 03841b1229
commit 5d63335a5c
12 changed files with 26 additions and 24 deletions

View File

@@ -31,8 +31,8 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@@ -74,7 +74,7 @@ public class JsonTestersAutoConfiguration {
}
@Bean
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ImportRuntimeHints(BasicJsonTesterRuntimeHints.class)
public FactoryBean<BasicJsonTester> basicJsonTesterFactoryBean() {
return new JsonTesterFactoryBean<BasicJsonTester, Void>(BasicJsonTester.class, null);
@@ -85,7 +85,7 @@ public class JsonTestersAutoConfiguration {
static class JacksonJsonTestersConfiguration {
@Bean
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnBean(ObjectMapper.class)
@ImportRuntimeHints(JacksonTesterRuntimeHints.class)
FactoryBean<JacksonTester<?>> jacksonTesterFactoryBean(ObjectMapper mapper) {
@@ -107,7 +107,7 @@ public class JsonTestersAutoConfiguration {
static class GsonJsonTestersConfiguration {
@Bean
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnBean(Gson.class)
@ImportRuntimeHints(GsonTesterRuntimeHints.class)
FactoryBean<GsonTester<?>> gsonTesterFactoryBean(Gson gson) {
@@ -129,7 +129,7 @@ public class JsonTestersAutoConfiguration {
static class JsonbJsonTesterConfiguration {
@Bean
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@ConditionalOnBean(Jsonb.class)
@ImportRuntimeHints(JsonbJsonTesterRuntimeHints.class)
FactoryBean<JsonbTester<?>> jsonbTesterFactoryBean(Jsonb jsonb) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2024 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.
@@ -24,6 +24,7 @@ import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -63,7 +64,7 @@ class WebMvcTestWebDriverCustomScopeIntegrationTests {
static class Config {
@Bean
@Scope("singleton")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
WebDriverFactory webDriver(MockMvc mockMvc) {
return new WebDriverFactory(mockMvc);
}