List of usage examples for org.springframework.context.support GenericApplicationContext registerBean
public final <T> void registerBean(Class<T> beanClass, BeanDefinitionCustomizer... customizers)
From source file:org.springframework.cloud.function.web.function.FunctionEndpointInitializer.java
private void registerWebFluxAutoConfiguration(GenericApplicationContext context) { context.registerBean(DefaultErrorWebExceptionHandler.class, () -> errorHandler(context)); context.registerBean(WebHttpHandlerBuilder.WEB_HANDLER_BEAN_NAME, HttpWebHandlerAdapter.class, () -> httpHandler(context)); context.addApplicationListener(new ServerListener(context)); }
From source file:org.springframework.cloud.function.web.function.FunctionEndpointInitializer.java
private void registerEndpoint(GenericApplicationContext context) { context.registerBean(StringConverter.class, () -> new BasicStringConverter(context.getBean(FunctionInspector.class), context.getBeanFactory())); context.registerBean(RequestProcessor.class, () -> new RequestProcessor(context.getBean(FunctionInspector.class), context.getBeanProvider(JsonMapper.class), context.getBean(StringConverter.class), context.getBeanProvider(ServerCodecConfigurer.class))); context.registerBean(FunctionEndpointFactory.class, () -> new FunctionEndpointFactory(context.getBean(FunctionCatalog.class), context.getBean(FunctionInspector.class), context.getBean(RequestProcessor.class), context.getEnvironment())); context.registerBean(RouterFunction.class, () -> context.getBean(FunctionEndpointFactory.class).functionEndpoints()); }
From source file:org.springframework.cloud.function.web.function.FunctionEndpointInitializer.java
private DefaultErrorWebExceptionHandler errorHandler(GenericApplicationContext context) { context.registerBean(ErrorAttributes.class, () -> new DefaultErrorAttributes()); context.registerBean(ErrorProperties.class, () -> new ErrorProperties()); context.registerBean(ResourceProperties.class, () -> new ResourceProperties()); DefaultErrorWebExceptionHandler handler = new DefaultErrorWebExceptionHandler( context.getBean(ErrorAttributes.class), context.getBean(ResourceProperties.class), context.getBean(ErrorProperties.class), context); ServerCodecConfigurer codecs = ServerCodecConfigurer.create(); handler.setMessageWriters(codecs.getWriters()); handler.setMessageReaders(codecs.getReaders()); return handler; }