提交 58431735 编写于 作者: J Juergen Hoeller

Polishing

上级 08c95fbc
...@@ -231,11 +231,7 @@ class ConfigurationClassParser { ...@@ -231,11 +231,7 @@ class ConfigurationClassParser {
// Explicit bean definition found, probably replacing an import. // Explicit bean definition found, probably replacing an import.
// Let's remove the old one and go with the new one. // Let's remove the old one and go with the new one.
this.configurationClasses.remove(configClass); this.configurationClasses.remove(configClass);
for (Iterator<ConfigurationClass> it = this.knownSuperclasses.values().iterator(); it.hasNext();) { this.knownSuperclasses.values().removeIf(configClass::equals);
if (configClass.equals(it.next())) {
it.remove();
}
}
} }
} }
......
...@@ -104,31 +104,6 @@ public class ReactiveAdapterRegistry { ...@@ -104,31 +104,6 @@ public class ReactiveAdapterRegistry {
} }
/**
* Return a shared default {@code ReactiveAdapterRegistry} instance, lazily
* building it once needed.
* <p><b>NOTE:</b> We highly recommend passing a long-lived, pre-configured
* {@code ReactiveAdapterRegistry} instance for customization purposes.
* This accessor is only meant as a fallback for code paths that want to
* fall back on a default instance if one isn't provided.
* @return the shared {@code ReactiveAdapterRegistry} instance (never {@code null})
* @since 5.0.2
*/
public static ReactiveAdapterRegistry getSharedInstance() {
ReactiveAdapterRegistry ar = sharedInstance;
if (ar == null) {
synchronized (ReactiveAdapterRegistry.class) {
ar = sharedInstance;
if (ar == null) {
ar = new ReactiveAdapterRegistry();
sharedInstance = ar;
}
}
}
return ar;
}
/** /**
* Whether the registry has any adapters which would be the case if any of * Whether the registry has any adapters which would be the case if any of
* Reactor, RxJava 2, or RxJava 1 (+ RxJava Reactive Streams bridge) are * Reactor, RxJava 2, or RxJava 1 (+ RxJava Reactive Streams bridge) are
...@@ -138,7 +113,6 @@ public class ReactiveAdapterRegistry { ...@@ -138,7 +113,6 @@ public class ReactiveAdapterRegistry {
return !this.adapters.isEmpty(); return !this.adapters.isEmpty();
} }
/** /**
* Register a reactive type along with functions to adapt to and from a * Register a reactive type along with functions to adapt to and from a
* Reactive Streams {@link Publisher}. The functions can assume their * Reactive Streams {@link Publisher}. The functions can assume their
...@@ -190,6 +164,31 @@ public class ReactiveAdapterRegistry { ...@@ -190,6 +164,31 @@ public class ReactiveAdapterRegistry {
} }
/**
* Return a shared default {@code ReactiveAdapterRegistry} instance, lazily
* building it once needed.
* <p><b>NOTE:</b> We highly recommend passing a long-lived, pre-configured
* {@code ReactiveAdapterRegistry} instance for customization purposes.
* This accessor is only meant as a fallback for code paths that want to
* fall back on a default instance if one isn't provided.
* @return the shared {@code ReactiveAdapterRegistry} instance (never {@code null})
* @since 5.0.2
*/
public static ReactiveAdapterRegistry getSharedInstance() {
ReactiveAdapterRegistry ar = sharedInstance;
if (ar == null) {
synchronized (ReactiveAdapterRegistry.class) {
ar = sharedInstance;
if (ar == null) {
ar = new ReactiveAdapterRegistry();
sharedInstance = ar;
}
}
}
return ar;
}
private static class ReactorRegistrar { private static class ReactorRegistrar {
void registerAdapters(ReactiveAdapterRegistry registry) { void registerAdapters(ReactiveAdapterRegistry registry) {
......
...@@ -44,6 +44,15 @@ public class DefaultConversionService extends GenericConversionService { ...@@ -44,6 +44,15 @@ public class DefaultConversionService extends GenericConversionService {
private static volatile DefaultConversionService sharedInstance; private static volatile DefaultConversionService sharedInstance;
/**
* Create a new {@code DefaultConversionService} with the set of
* {@linkplain DefaultConversionService#addDefaultConverters(ConverterRegistry) default converters}.
*/
public DefaultConversionService() {
addDefaultConverters(this);
}
/** /**
* Return a shared default {@code ConversionService} instance, * Return a shared default {@code ConversionService} instance,
* lazily building it once needed. * lazily building it once needed.
...@@ -69,18 +78,6 @@ public class DefaultConversionService extends GenericConversionService { ...@@ -69,18 +78,6 @@ public class DefaultConversionService extends GenericConversionService {
return cs; return cs;
} }
/**
* Create a new {@code DefaultConversionService} with the set of
* {@linkplain DefaultConversionService#addDefaultConverters(ConverterRegistry) default converters}.
*/
public DefaultConversionService() {
addDefaultConverters(this);
}
// static utility methods
/** /**
* Add converters appropriate for most environments. * Add converters appropriate for most environments.
* @param converterRegistry the registry of converters to add to (must also be castable to ConversionService, * @param converterRegistry the registry of converters to add to (must also be castable to ConversionService,
...@@ -134,9 +131,6 @@ public class DefaultConversionService extends GenericConversionService { ...@@ -134,9 +131,6 @@ public class DefaultConversionService extends GenericConversionService {
converterRegistry.addConverter(new StreamConverter(conversionService)); converterRegistry.addConverter(new StreamConverter(conversionService));
} }
// internal helpers
private static void addScalarConverters(ConverterRegistry converterRegistry) { private static void addScalarConverters(ConverterRegistry converterRegistry) {
converterRegistry.addConverterFactory(new NumberToNumberConverterFactory()); converterRegistry.addConverterFactory(new NumberToNumberConverterFactory());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册