Skip to content

Commit 9b98dd6

Browse files
committed
Fixes compilation errors and polishing
1 parent 88cf491 commit 9b98dd6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/config/ContextFunctionCatalogInitializer.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
3434
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
3535
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
36-
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
3736
import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor;
3837
import org.springframework.cloud.function.context.FunctionCatalog;
3938
import org.springframework.cloud.function.context.FunctionProperties;
@@ -121,14 +120,14 @@ protected void register(BeanDefinitionRegistry registry, ConfigurableListableBea
121120
if (this.context.getBeanFactory().getBeanNamesForType(PropertySourcesPlaceholderConfigurer.class, false,
122121
false).length == 0) {
123122
this.context.registerBean(PropertySourcesPlaceholderConfigurer.class,
124-
() -> PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer());
123+
PropertySourcesPlaceholderConfigurer::new);
125124
}
126125

127126
if (!this.context.getBeanFactory()
128127
.containsBeanDefinition(AnnotationConfigUtils.CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME)) {
129128
// Switch off the ConfigurationClassPostProcessor
130129
this.context.registerBean(AnnotationConfigUtils.CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME,
131-
DummyProcessor.class, () -> new DummyProcessor());
130+
DummyProcessor.class, DummyProcessor::new);
132131
// But switch on other annotation processing
133132
AnnotationConfigUtils.registerAnnotationConfigProcessors(this.context);
134133
}
@@ -138,7 +137,7 @@ protected void register(BeanDefinitionRegistry registry, ConfigurableListableBea
138137

139138
if (ClassUtils.isPresent("com.google.gson.Gson", null) && "gson".equals(preferredMapper)) {
140139
if (this.context.getBeanFactory().getBeanNamesForType(Gson.class, false, false).length == 0) {
141-
this.context.registerBean(Gson.class, () -> new Gson());
140+
this.context.registerBean(Gson.class, Gson::new);
142141
}
143142
this.context.registerBean(JsonMapper.class, () -> new ContextFunctionCatalogAutoConfiguration.JsonMapperConfiguration().jsonMapper(this.context));
144143
}
@@ -184,7 +183,7 @@ && new ClassPathResource(basePackage.replace(".", "/")).exists()) {
184183
ConversionService conversionService = new DefaultConversionService();
185184
return new SimpleFunctionRegistry(conversionService, messageConverter, this.context.getBean(JsonMapper.class));
186185
});
187-
this.context.registerBean(FunctionProperties.class, () -> new FunctionProperties());
186+
this.context.registerBean(FunctionProperties.class, FunctionProperties::new);
188187
this.context.registerBean(FunctionRegistrationPostProcessor.class,
189188
() -> new FunctionRegistrationPostProcessor(this.context.getAutowireCapableBeanFactory()
190189
.getBeanProvider(FunctionRegistration.class)));
@@ -200,7 +199,7 @@ private void performPreinitialization() {
200199

201200
@Override
202201
public void run() {
203-
runSafely(() -> new DefaultFormattingConversionService());
202+
runSafely(DefaultFormattingConversionService::new);
204203
}
205204

206205
public void runSafely(Runnable runnable) {

0 commit comments

Comments
 (0)