DATAREST-1567 - Replace component scan with explicit bean methods.
We replaced the component scan in RespositoryRestMvcConfiguration with dedicated bean methods. This allows us to be more explicit in resolving required components, which is required for better support of GraalVM native image. Original pull request: #382.
This commit is contained in:
committed by
Oliver Drotbohm
parent
060c84dcf3
commit
8ff438678d
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.rest.webmvc.halexplorer;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
|
||||
import org.springframework.data.rest.webmvc.config.StaticResourceProvider;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
@@ -23,9 +25,11 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
|
||||
* {@link StaticResourceProvider} to expose the HAL Browser WebJar content via a static resource route.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
* @author Christoph Strobl
|
||||
* @since 3.2
|
||||
* @soundtrack Tedeschi Trucks Band - Signs, High Times (Signs)
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class HalExplorerConfiguration implements StaticResourceProvider {
|
||||
|
||||
/*
|
||||
@@ -39,4 +43,17 @@ class HalExplorerConfiguration implements StaticResourceProvider {
|
||||
|
||||
registry.addResourceHandler(basePath.concat("/**")).addResourceLocations(rootLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* The controller that exposes the {@link HalExplorer}.
|
||||
*
|
||||
* @return never {@literal null}.
|
||||
* @since 3.4
|
||||
*/
|
||||
@Bean
|
||||
HalExplorer halExplorer() {
|
||||
|
||||
// TODO: maybe register this one directly on mvc via WebMvcConfigurer.addRedirectVieController()
|
||||
return new HalExplorer();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user