Spring boot 用于更改前端资源目录的Spring引导属性
我有一个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
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());
}
}