@@ -38,9 +38,9 @@ import org.springframework.beans.factory.BeanFactory;
|
|||||||
import org.springframework.beans.factory.BeanFactoryAware;
|
import org.springframework.beans.factory.BeanFactoryAware;
|
||||||
import org.springframework.beans.factory.BeanNameAware;
|
import org.springframework.beans.factory.BeanNameAware;
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
|
||||||
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
|
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
|
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||||
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
||||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||||
@@ -91,11 +91,12 @@ public class KotlinLambdaToFunctionAutoConfiguration {
|
|||||||
* @return the bean factory post processor
|
* @return the bean factory post processor
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public SmartInitializingSingleton kotlinToFunctionTransformer(ConfigurableListableBeanFactory beanFactory) {
|
public static BeanFactoryPostProcessor kotlinToFunctionTransformer(ConfigurableListableBeanFactory beanFactory) {
|
||||||
return new SmartInitializingSingleton() {
|
return new BeanFactoryPostProcessor() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterSingletonsInstantiated() {
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
|
||||||
|
throws BeansException {
|
||||||
String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
|
String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
|
||||||
for (String beanDefinitionName : beanDefinitionNames) {
|
for (String beanDefinitionName : beanDefinitionNames) {
|
||||||
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanDefinitionName);
|
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanDefinitionName);
|
||||||
@@ -112,11 +113,9 @@ public class KotlinLambdaToFunctionAutoConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public static final class KotlinFunctionWrapper implements Function<Object, Object>, Supplier<Object>, Consumer<Object>,
|
public static final class KotlinFunctionWrapper implements Function<Object, Object>, Supplier<Object>, Consumer<Object>,
|
||||||
Function0<Object>, Function1<Object, Object>, Function2<Object, Object, Object>,
|
Function0<Object>, Function1<Object, Object>, Function2<Object, Object, Object>,
|
||||||
|
|||||||
Reference in New Issue
Block a user