org.springframework.boot.autoconfigure.web.ResourceProperties Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.web.ResourceProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ErrorHandlerConfiguration.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
public ErrorHandlerConfiguration(ServerProperties serverProperties,
                                 ResourceProperties resourceProperties,
                                 ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                 ServerCodecConfigurer serverCodecConfigurer,
                                 ApplicationContext applicationContext) {
	this.serverProperties = serverProperties;
	this.applicationContext = applicationContext;
	this.resourceProperties = resourceProperties;
	this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
	this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #2
Source File: FunctionEndpointInitializer.java    From spring-cloud-function with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: ExceptionAutoConfiguration.java    From SpringCloud with Apache License 2.0 5 votes vote down vote up
public ExceptionAutoConfiguration(ServerProperties serverProperties,
                                  ResourceProperties resourceProperties,
                                  ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                  ServerCodecConfigurer serverCodecConfigurer,
                                  ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider
            .getIfAvailable(() -> Collections.emptyList());
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #4
Source File: ExceptionAutoConfiguration.java    From JetfireCloud with Apache License 2.0 5 votes vote down vote up
public ExceptionAutoConfiguration(ServerProperties serverProperties,
                                  ResourceProperties resourceProperties,
                                  ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                  ServerCodecConfigurer serverCodecConfigurer,
                                  ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider
            .getIfAvailable(() -> Collections.emptyList());
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #5
Source File: ErrorHandlerConfiguration.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
public ErrorHandlerConfiguration(ServerProperties serverProperties,
                                 ResourceProperties resourceProperties,
                                 ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                 ServerCodecConfigurer serverCodecConfigurer,
                                 ApplicationContext applicationContext) {
	this.serverProperties = serverProperties;
	this.applicationContext = applicationContext;
	this.resourceProperties = resourceProperties;
	this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
	this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #6
Source File: ErrorHandlerConfiguration.java    From soul with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new Error handler configuration.
 *
 * @param serverProperties      the server properties
 * @param resourceProperties    the resource properties
 * @param viewResolversProvider the view resolvers provider
 * @param serverCodecConfigurer the server codec configurer
 * @param applicationContext    the application context
 */
public ErrorHandlerConfiguration(final ServerProperties serverProperties,
                                 final ResourceProperties resourceProperties,
                                 final ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                 final ServerCodecConfigurer serverCodecConfigurer,
                                 final ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #7
Source File: ErrorHandler.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
public ErrorHandler(ServerProperties serverProperties,
                    ResourceProperties resourceProperties,
                    ObjectProvider<List<ViewResolver>> viewResolversProvider,
                    ServerCodecConfigurer serverCodecConfigurer,
                    ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #8
Source File: ErrorHandler.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
public ErrorHandler(ServerProperties serverProperties,
                    ResourceProperties resourceProperties,
                    ObjectProvider<List<ViewResolver>> viewResolversProvider,
                    ServerCodecConfigurer serverCodecConfigurer,
                    ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #9
Source File: ErrorHandlerConfiguration.java    From sophia_scaffolding with Apache License 2.0 5 votes vote down vote up
public ErrorHandlerConfiguration(ServerProperties serverProperties,
                                 ResourceProperties resourceProperties,
                                 ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                 ServerCodecConfigurer serverCodecConfigurer,
                                 ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #10
Source File: ErrorHandlerConfiguration.java    From momo-cloud-permission with Apache License 2.0 5 votes vote down vote up
public ErrorHandlerConfiguration(ServerProperties serverProperties,
                                 ResourceProperties resourceProperties,
                                 ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                 ServerCodecConfigurer serverCodecConfigurer,
                                 ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #11
Source File: FwGatewayErrorConfigure.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
public FwGatewayErrorConfigure(ServerProperties serverProperties,
                                 ResourceProperties resourceProperties,
                                 ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                 ServerCodecConfigurer serverCodecConfigurer,
                                 ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #12
Source File: ErrorHandlerConfiguration.java    From SpringBlade with Apache License 2.0 5 votes vote down vote up
public ErrorHandlerConfiguration(ServerProperties serverProperties,
								 ResourceProperties resourceProperties,
								 ObjectProvider<List<ViewResolver>> viewResolversProvider,
								 ServerCodecConfigurer serverCodecConfigurer,
								 ApplicationContext applicationContext) {
	this.serverProperties = serverProperties;
	this.applicationContext = applicationContext;
	this.resourceProperties = resourceProperties;
	this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
	this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #13
Source File: CustomErrorWebFluxAutoConfiguration.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
public CustomErrorWebFluxAutoConfiguration(ServerProperties serverProperties,
                                           ResourceProperties resourceProperties,
                                           ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                           ServerCodecConfigurer serverCodecConfigurer,
                                           ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #14
Source File: WebExceptionConfig.java    From influx-proxy with Apache License 2.0 5 votes vote down vote up
public WebExceptionConfig(ServerProperties serverProperties,
                                     ResourceProperties resourceProperties,
                                     ObjectProvider<ViewResolver> viewResolversProvider,
                                     ServerCodecConfigurer serverCodecConfigurer,
                                     ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.orderedStream()
            .collect(Collectors.toList());
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #15
Source File: ErrorHandlerConfig.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
public ErrorHandlerConfig(ServerProperties serverProperties,
                                 ResourceProperties resourceProperties,
                                 ObjectProvider<List<ViewResolver>> viewResolversProvider,
                                 ServerCodecConfigurer serverCodecConfigurer,
                                 ApplicationContext applicationContext) {
    this.serverProperties = serverProperties;
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #16
Source File: GlobalErrorWebFluxConfiguration.java    From light-security with Apache License 2.0 5 votes vote down vote up
public GlobalErrorWebFluxConfiguration(
        ApplicationContext applicationContext,
        ResourceProperties resourceProperties,
        List<ViewResolver> viewResolvers,
        ServerCodecConfigurer serverCodecConfigurer
) {
    this.applicationContext = applicationContext;
    this.resourceProperties = resourceProperties;
    this.viewResolvers = viewResolvers;
    this.serverCodecConfigurer = serverCodecConfigurer;
}
 
Example #17
Source File: GlobalExceptionHandler.java    From codeway_service with GNU General Public License v3.0 4 votes vote down vote up
public GlobalExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                              ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #18
Source File: GlobalErrorWebExceptionHandler.java    From tutorials with MIT License 4 votes vote down vote up
public GlobalErrorWebExceptionHandler(GlobalErrorAttributes g, ApplicationContext applicationContext, 
        ServerCodecConfigurer serverCodecConfigurer) {
    super(g, new ResourceProperties(), applicationContext);
    super.setMessageWriters(serverCodecConfigurer.getWriters());
    super.setMessageReaders(serverCodecConfigurer.getReaders());
}
 
Example #19
Source File: GlobalExceptionHandler.java    From codeway_service with GNU General Public License v3.0 4 votes vote down vote up
public GlobalExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                              ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #20
Source File: GlobalErrorWebExceptionHandler.java    From microservice-integration with MIT License 4 votes vote down vote up
public GlobalErrorWebExceptionHandler(GlobalErrorAttributes g, ApplicationContext applicationContext,
                                      ServerCodecConfigurer serverCodecConfigurer) {
    super(g, new ResourceProperties(), applicationContext);
    super.setMessageWriters(serverCodecConfigurer.getWriters());
    super.setMessageReaders(serverCodecConfigurer.getReaders());
}
 
Example #21
Source File: GlobalErrorWebExceptionHandler.java    From springboot-learning-example with Apache License 2.0 4 votes vote down vote up
public GlobalErrorWebExceptionHandler(GlobalErrorAttributes g, ApplicationContext applicationContext,
        ServerCodecConfigurer serverCodecConfigurer) {
    super(g, new ResourceProperties(), applicationContext);
    super.setMessageWriters(serverCodecConfigurer.getWriters());
    super.setMessageReaders(serverCodecConfigurer.getReaders());
}
 
Example #22
Source File: Application.java    From liiklus with MIT License 4 votes vote down vote up
public static SpringApplication createSpringApplication(String[] args) {
    var environment = new StandardEnvironment();
    environment.setDefaultProfiles("exporter", "gateway");
    environment.getPropertySources().addFirst(new SimpleCommandLinePropertySource(args));

    var pluginsDir = environment.getProperty("plugins.dir", String.class, "./plugins");
    var pathMatcher = environment.getProperty("plugins.pathMatcher", String.class, "*.jar");

    var pluginsRoot = Paths.get(pluginsDir).toAbsolutePath().normalize();
    log.info("Loading plugins from '{}' with matcher: '{}'", pluginsRoot, pathMatcher);

    var pluginManager = new LiiklusPluginManager(pluginsRoot, pathMatcher);

    pluginManager.loadPlugins();
    pluginManager.startPlugins();

    var binder = Binder.get(environment);
    var application = new SpringApplication(Application.class) {
        @Override
        protected void load(ApplicationContext context, Object[] sources) {
            // We don't want the annotation bean definition reader
        }
    };
    application.setWebApplicationType(WebApplicationType.REACTIVE);
    application.setApplicationContextClass(ReactiveWebServerApplicationContext.class);
    application.setEnvironment(environment);

    application.addInitializers(
            new StringCodecInitializer(false, true),
            new ResourceCodecInitializer(false),
            new ReactiveWebServerInitializer(
                    binder.bind("server", ServerProperties.class).orElseGet(ServerProperties::new),
                    binder.bind("spring.resources", ResourceProperties.class).orElseGet(ResourceProperties::new),
                    binder.bind("spring.webflux", WebFluxProperties.class).orElseGet(WebFluxProperties::new),
                    new NettyReactiveWebServerFactory()
            ),
            new GatewayConfiguration(),
            (GenericApplicationContext applicationContext) -> {
                applicationContext.registerBean("health", RouterFunction.class, () -> {
                    return RouterFunctions.route()
                            .GET("/health", __ -> ServerResponse.ok().bodyValue("OK"))
                            .build();
                });

                applicationContext.registerBean(PluginManager.class, () -> pluginManager);
            }
    );

    application.addInitializers(
            pluginManager.getExtensionClasses(ApplicationContextInitializer.class).stream()
                    .map(it -> {
                        try {
                            return it.getDeclaredConstructor().newInstance();
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    })
                    .toArray(ApplicationContextInitializer[]::new)
    );

    return application;
}
 
Example #23
Source File: ReactiveWebServerInitializer.java    From spring-fu with Apache License 2.0 4 votes vote down vote up
public ReactiveWebServerInitializer(ServerProperties serverProperties, ResourceProperties resourceProperties, WebFluxProperties webFluxProperties, ConfigurableReactiveWebServerFactory serverFactory) {
	this.serverProperties = serverProperties;
	this.resourceProperties = resourceProperties;
	this.webFluxProperties = webFluxProperties;
	this.serverFactory = serverFactory;
}
 
Example #24
Source File: ServletWebServerInitializer.java    From spring-fu with Apache License 2.0 4 votes vote down vote up
public ServletWebServerInitializer(ServerProperties serverProperties, WebMvcProperties webMvcProperties, ResourceProperties resourceProperties) {
	this.serverProperties = serverProperties;
	this.webMvcProperties = webMvcProperties;
	this.resourceProperties = resourceProperties;
}
 
Example #25
Source File: ErrorExceptionHandler.java    From SpringBlade with Apache License 2.0 4 votes vote down vote up
public ErrorExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
							 ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #26
Source File: GlobalErrorWebExceptionHandler.java    From light-security with Apache License 2.0 4 votes vote down vote up
public GlobalErrorWebExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, applicationContext);
}
 
Example #27
Source File: JsonExceptionHandler.java    From sophia_scaffolding with Apache License 2.0 4 votes vote down vote up
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                            ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #28
Source File: JsonExceptionHandler.java    From open-capacity-platform with Apache License 2.0 4 votes vote down vote up
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
		ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #29
Source File: JsonExceptionHandler.java    From sophia_scaffolding with Apache License 2.0 4 votes vote down vote up
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                            ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #30
Source File: JsonExceptionHandler.java    From sophia_scaffolding with Apache License 2.0 4 votes vote down vote up
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                            ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}