Skip to content

Commit 57cad53

Browse files
committed
Adapt to latest API change
1 parent 3c21ade commit 57cad53

File tree

6 files changed

+0
-476
lines changed

6 files changed

+0
-476
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616

1717
package org.springframework.boot.web.reactive.context;
1818

19-
import java.lang.annotation.Annotation;
2019
import java.util.Arrays;
2120
import java.util.LinkedHashSet;
2221
import java.util.Set;
23-
import java.util.function.Supplier;
2422

2523
import org.springframework.beans.factory.support.BeanNameGenerator;
2624
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -67,8 +65,6 @@ public class AnnotationConfigReactiveWebApplicationContext
6765

6866
private final Set<String> basePackages = new LinkedHashSet<>();
6967

70-
private final Set<BeanRegistration> registeredBeans = new LinkedHashSet<>();
71-
7268
@Override
7369
protected ConfigurableEnvironment createEnvironment() {
7470
return new StandardReactiveWebEnvironment();
@@ -143,23 +139,6 @@ public void register(Class<?>... annotatedClasses) {
143139
this.annotatedClasses.addAll(Arrays.asList(annotatedClasses));
144140
}
145141

146-
@Override
147-
@SafeVarargs
148-
@SuppressWarnings("varargs")
149-
public final <T> void registerBean(Class<T> annotatedClass,
150-
Class<? extends Annotation>... qualifiers) {
151-
this.registeredBeans.add(new BeanRegistration(annotatedClass, null, qualifiers));
152-
}
153-
154-
@Override
155-
@SafeVarargs
156-
@SuppressWarnings("varargs")
157-
public final <T> void registerBean(Class<T> annotatedClass, Supplier<T> supplier,
158-
Class<? extends Annotation>... qualifiers) {
159-
this.registeredBeans
160-
.add(new BeanRegistration(annotatedClass, supplier, qualifiers));
161-
}
162-
163142
/**
164143
* Perform a scan within the specified base packages.
165144
* <p>
@@ -242,9 +221,6 @@ private void loadBeanDefinitions(AnnotatedBeanDefinitionReader reader,
242221
if (!this.basePackages.isEmpty()) {
243222
scanBasePackages(scanner);
244223
}
245-
if (!this.registeredBeans.isEmpty()) {
246-
registerBeans(reader);
247-
}
248224
String[] configLocations = getConfigLocations();
249225
if (configLocations != null) {
250226
registerConfigLocations(reader, scanner, configLocations);
@@ -269,16 +245,6 @@ private void scanBasePackages(ClassPathBeanDefinitionScanner scanner) {
269245
scanner.scan(StringUtils.toStringArray(this.basePackages));
270246
}
271247

272-
private void registerBeans(AnnotatedBeanDefinitionReader reader) {
273-
if (this.logger.isDebugEnabled()) {
274-
this.logger.debug("Registering supplied beans: ["
275-
+ StringUtils.collectionToCommaDelimitedString(this.registeredBeans)
276-
+ "]");
277-
}
278-
this.registeredBeans.forEach((reg) -> reader.registerBean(reg.getAnnotatedClass(),
279-
reg.getSupplier(), reg.getQualifiers()));
280-
}
281-
282248
private void registerConfigLocations(AnnotatedBeanDefinitionReader reader,
283249
ClassPathBeanDefinitionScanner scanner, String[] configLocations)
284250
throws LinkageError {
@@ -357,45 +323,4 @@ protected Resource getResourceByPath(String path) {
357323
return new FilteredReactiveWebContextResource(path);
358324
}
359325

360-
/**
361-
* Holder for a programmatic bean registration.
362-
*
363-
* @see #registerBean(Class, Class[])
364-
* @see #registerBean(Class, Supplier, Class[])
365-
*/
366-
private static class BeanRegistration {
367-
368-
private final Class<?> annotatedClass;
369-
370-
private final Supplier<?> supplier;
371-
372-
private final Class<? extends Annotation>[] qualifiers;
373-
374-
BeanRegistration(Class<?> annotatedClass, Supplier<?> supplier,
375-
Class<? extends Annotation>[] qualifiers) {
376-
this.annotatedClass = annotatedClass;
377-
this.supplier = supplier;
378-
this.qualifiers = qualifiers;
379-
}
380-
381-
public Class<?> getAnnotatedClass() {
382-
return this.annotatedClass;
383-
}
384-
385-
@SuppressWarnings("rawtypes")
386-
public Supplier getSupplier() {
387-
return this.supplier;
388-
}
389-
390-
public Class<? extends Annotation>[] getQualifiers() {
391-
return this.qualifiers;
392-
}
393-
394-
@Override
395-
public String toString() {
396-
return this.annotatedClass.getName();
397-
}
398-
399-
}
400-
401326
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebServerApplicationContext.java

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616

1717
package org.springframework.boot.web.reactive.context;
1818

19-
import java.lang.annotation.Annotation;
2019
import java.util.Arrays;
2120
import java.util.LinkedHashSet;
2221
import java.util.Set;
23-
import java.util.function.Supplier;
2422

2523
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
2624
import org.springframework.beans.factory.support.BeanNameGenerator;
@@ -37,7 +35,6 @@
3735
import org.springframework.util.Assert;
3836
import org.springframework.util.ClassUtils;
3937
import org.springframework.util.ObjectUtils;
40-
import org.springframework.util.StringUtils;
4138

4239
/**
4340
* {@link ReactiveWebServerApplicationContext} that accepts annotated classes as input -
@@ -70,8 +67,6 @@ public class AnnotationConfigReactiveWebServerApplicationContext
7067

7168
private String[] basePackages;
7269

73-
private final Set<BeanRegistration> registeredBeans = new LinkedHashSet<>();
74-
7570
/**
7671
* Create a new {@link AnnotationConfigReactiveWebServerApplicationContext} that needs
7772
* to be populated through {@link #register} calls and then manually
@@ -202,45 +197,6 @@ public final void scan(String... basePackages) {
202197
this.basePackages = basePackages;
203198
}
204199

205-
/**
206-
* Register a bean from the given bean class.
207-
* @param annotatedClass the class of the bean
208-
* @param <T> the type of the bean
209-
* @since 2.2.0
210-
*/
211-
public final <T> void registerBean(Class<T> annotatedClass) {
212-
this.registeredBeans.add(new BeanRegistration(annotatedClass, null, null));
213-
}
214-
215-
/**
216-
* Register a bean from the given bean class, using the given supplier for obtaining a
217-
* new instance (typically declared as a lambda expression or method reference).
218-
* @param annotatedClass the class of the bean
219-
* @param supplier a callback for creating an instance of the bean
220-
* @param <T> the type of the bean
221-
* @since 2.2.0
222-
*/
223-
public final <T> void registerBean(Class<T> annotatedClass, Supplier<T> supplier) {
224-
this.registeredBeans.add(new BeanRegistration(annotatedClass, supplier, null));
225-
}
226-
227-
@Override
228-
@SafeVarargs
229-
@SuppressWarnings("varargs")
230-
public final <T> void registerBean(Class<T> annotatedClass,
231-
Class<? extends Annotation>... qualifiers) {
232-
this.registeredBeans.add(new BeanRegistration(annotatedClass, null, qualifiers));
233-
}
234-
235-
@Override
236-
@SafeVarargs
237-
@SuppressWarnings("varargs")
238-
public final <T> void registerBean(Class<T> annotatedClass, Supplier<T> supplier,
239-
Class<? extends Annotation>... qualifiers) {
240-
this.registeredBeans
241-
.add(new BeanRegistration(annotatedClass, supplier, qualifiers));
242-
}
243-
244200
@Override
245201
protected void prepareRefresh() {
246202
this.scanner.clearCache();
@@ -256,60 +212,6 @@ protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactor
256212
if (!this.annotatedClasses.isEmpty()) {
257213
this.reader.register(ClassUtils.toClassArray(this.annotatedClasses));
258214
}
259-
if (!this.registeredBeans.isEmpty()) {
260-
registerBeans(this.reader);
261-
}
262-
}
263-
264-
private void registerBeans(AnnotatedBeanDefinitionReader reader) {
265-
if (this.logger.isDebugEnabled()) {
266-
this.logger.debug("Registering supplied beans: ["
267-
+ StringUtils.collectionToCommaDelimitedString(this.registeredBeans)
268-
+ "]");
269-
}
270-
this.registeredBeans.forEach((reg) -> reader.registerBean(reg.getAnnotatedClass(),
271-
reg.getSupplier(), reg.getQualifiers()));
272-
}
273-
274-
/**
275-
* Holder for a programmatic bean registration.
276-
*
277-
* @see #registerBean(Class, Class[])
278-
* @see #registerBean(Class, Supplier, Class[])
279-
*/
280-
private static class BeanRegistration {
281-
282-
private final Class<?> annotatedClass;
283-
284-
private final Supplier<?> supplier;
285-
286-
private final Class<? extends Annotation>[] qualifiers;
287-
288-
BeanRegistration(Class<?> annotatedClass, Supplier<?> supplier,
289-
Class<? extends Annotation>[] qualifiers) {
290-
this.annotatedClass = annotatedClass;
291-
this.supplier = supplier;
292-
this.qualifiers = qualifiers;
293-
}
294-
295-
public Class<?> getAnnotatedClass() {
296-
return this.annotatedClass;
297-
}
298-
299-
@SuppressWarnings("rawtypes")
300-
public Supplier getSupplier() {
301-
return this.supplier;
302-
}
303-
304-
public Class<? extends Annotation>[] getQualifiers() {
305-
return this.qualifiers;
306-
}
307-
308-
@Override
309-
public String toString() {
310-
return this.annotatedClass.getName();
311-
}
312-
313215
}
314216

315217
}

0 commit comments

Comments
 (0)