Add proxyTargetBeans = false
This commit is contained in:
committed by
Oleg Zhurakousky
parent
70d46f8b9f
commit
521c6d3397
@@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
// @checkstyle:off
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(proxyBeanMethods = false)
|
||||
public class TaskApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableTask
|
||||
@EnableConfigurationProperties(TaskConfigurationProperties.class)
|
||||
@ConditionalOnClass({ EnableTask.class })
|
||||
@@ -46,10 +46,9 @@ public class TaskConfiguration {
|
||||
|
||||
@Bean
|
||||
public CommandLineRunner commandLineRunner(FunctionCatalog registry) {
|
||||
final Supplier<Publisher<Object>> supplier = registry.lookup(Supplier.class,
|
||||
this.properties.getSupplier());
|
||||
final Function<Publisher<Object>, Publisher<Object>> function = registry
|
||||
.lookup(Function.class, this.properties.getFunction());
|
||||
final Supplier<Publisher<Object>> supplier = registry.lookup(Supplier.class, this.properties.getSupplier());
|
||||
final Function<Publisher<Object>, Publisher<Object>> function = registry.lookup(Function.class,
|
||||
this.properties.getFunction());
|
||||
final Consumer<Publisher<Object>> consumer = consumer(registry);
|
||||
CommandLineRunner runner = new CommandLineRunner() {
|
||||
|
||||
@@ -62,13 +61,12 @@ public class TaskConfiguration {
|
||||
}
|
||||
|
||||
private Consumer<Publisher<Object>> consumer(FunctionCatalog registry) {
|
||||
Consumer<Publisher<Object>> consumer = registry.lookup(Consumer.class,
|
||||
this.properties.getConsumer());
|
||||
Consumer<Publisher<Object>> consumer = registry.lookup(Consumer.class, this.properties.getConsumer());
|
||||
if (consumer != null) {
|
||||
return consumer;
|
||||
}
|
||||
Function<Publisher<Object>, Publisher<Void>> function = registry
|
||||
.lookup(Function.class, this.properties.getConsumer());
|
||||
Function<Publisher<Object>, Publisher<Void>> function = registry.lookup(Function.class,
|
||||
this.properties.getConsumer());
|
||||
return flux -> Mono.from(function.apply(flux)).subscribe();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
// @checkstyle:off
|
||||
@SpringBootConfiguration
|
||||
@SpringBootConfiguration(proxyBeanMethods = false)
|
||||
@EnableAutoConfiguration
|
||||
public class RestApplication {
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandl
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass({ Flux.class, AsyncHandlerMethodReturnValueHandler.class })
|
||||
@ConditionalOnWebApplication(type = Type.REACTIVE)
|
||||
@Import({ FunctionController.class, RequestProcessor.class })
|
||||
@@ -49,8 +49,7 @@ import org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandl
|
||||
public class ReactorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public FunctionHandlerMapping functionHandlerMapping(FunctionCatalog catalog,
|
||||
FunctionController controller) {
|
||||
public FunctionHandlerMapping functionHandlerMapping(FunctionCatalog catalog, FunctionController controller) {
|
||||
return new FunctionHandlerMapping(catalog, controller);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandl
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnWebApplication(type = Type.SERVLET)
|
||||
@ConditionalOnClass({ Flux.class, AsyncHandlerMethodReturnValueHandler.class })
|
||||
@Import({ FunctionController.class, RequestProcessor.class })
|
||||
@@ -49,8 +49,7 @@ import org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandl
|
||||
public class ReactorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public FunctionHandlerMapping functionHandlerMapping(FunctionCatalog catalog,
|
||||
FunctionController controller) {
|
||||
public FunctionHandlerMapping functionHandlerMapping(FunctionCatalog catalog, FunctionController controller) {
|
||||
return new FunctionHandlerMapping(catalog, controller);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(WebClient.class)
|
||||
@Conditional(SourceActiveCondition.class)
|
||||
@EnableConfigurationProperties(ExporterProperties.class)
|
||||
@@ -56,21 +56,17 @@ public class FunctionExporterAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.function.web.export.sink", name = "url")
|
||||
public SupplierExporter sourceForwarder(RequestBuilder requestBuilder,
|
||||
DestinationResolver destinationResolver, FunctionCatalog catalog,
|
||||
WebClient.Builder builder) {
|
||||
return new SupplierExporter(requestBuilder, destinationResolver, catalog,
|
||||
builder.build(), this.props);
|
||||
public SupplierExporter sourceForwarder(RequestBuilder requestBuilder, DestinationResolver destinationResolver,
|
||||
FunctionCatalog catalog, WebClient.Builder builder) {
|
||||
return new SupplierExporter(requestBuilder, destinationResolver, catalog, builder.build(), this.props);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cloud.function.web.export.source", name = "url")
|
||||
public FunctionRegistration<Supplier<Flux<?>>> origin(WebClient.Builder builder) {
|
||||
HttpSupplier supplier = new HttpSupplier(builder.build(), this.props);
|
||||
FunctionRegistration<Supplier<Flux<?>>> registration = new FunctionRegistration<>(
|
||||
supplier);
|
||||
FunctionType type = FunctionType.supplier(this.props.getSource().getType())
|
||||
.wrap(Flux.class);
|
||||
FunctionRegistration<Supplier<Flux<?>>> registration = new FunctionRegistration<>(supplier);
|
||||
FunctionType type = FunctionType.supplier(this.props.getSource().getType()).wrap(Flux.class);
|
||||
if (this.props.getSource().isIncludeHeaders()) {
|
||||
type = type.message();
|
||||
}
|
||||
|
||||
@@ -46,8 +46,11 @@ class FunctionExporterInitializer implements ApplicationContextInitializer<Gener
|
||||
}
|
||||
|
||||
private void registerWebClient(GenericApplicationContext context) {
|
||||
if (context.getBeanFactory().getBeanNamesForType(WebClient.Builder.class, false, false).length == 0) {
|
||||
context.registerBean(WebClient.Builder.class, () -> WebClient.builder());
|
||||
if (ClassUtils.isPresent("org.springframework.web.reactive.function.client.WebClient",
|
||||
getClass().getClassLoader())) {
|
||||
if (context.getBeanFactory().getBeanNamesForType(WebClient.Builder.class, false, false).length == 0) {
|
||||
context.registerBean(WebClient.Builder.class, () -> WebClient.builder());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user