Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 用于更改前端资源目录的Spring引导属性_Spring Boot_Frontend_Application.properties - Fatal编程技术网

Spring boot 用于更改前端资源目录的Spring引导属性

Spring boot 用于更改前端资源目录的Spring引导属性,spring-boot,frontend,application.properties,Spring Boot,Frontend,Application.properties,我有一个Spring启动应用程序,我想更改我前端的目录。我不想让前端资源位于目录resources/static中,而是想将它们移到resources之外的另一个目录中。我需要更改哪些属性,以便我的应用程序考虑用于呈现前端的新目录?您可以使用以下配置其他资源映射: @Component public class ResourcesMvcAdapter extends WebMvcConfigurerAdapter { private final Path resourcePath = P

我有一个Spring启动应用程序,我想更改我前端的目录。我不想让前端资源位于目录
resources/static
中,而是想将它们移到
resources
之外的另一个目录中。我需要更改哪些属性,以便我的应用程序考虑用于呈现前端的新目录?

您可以使用以下配置其他资源映射:

@Component
public class ResourcesMvcAdapter extends WebMvcConfigurerAdapter {

   private final Path resourcePath = Paths.get( ... );

   @Override
   public void addResourceHandlers(ResourceHandlerRegistry registry) {
     registry.addResourceHandler("/resources/**")
             .addResourceLocations(resourcePath.toUri().toString()); 
   }

}