Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
Angularjs Sprint引导不支持bootstrap index.html_Angularjs_Spring Mvc_Spring Boot - Fatal编程技术网

Angularjs Sprint引导不支持bootstrap index.html

Angularjs Sprint引导不支持bootstrap index.html,angularjs,spring-mvc,spring-boot,Angularjs,Spring Mvc,Spring Boot,我有一个角形弹簧靴项目,其结构如下图所示: 如您所见,index.html位于resources/static/app下,为了将此位置包含为资源位置,我执行了以下操作: @Configuration public class WebMvcConfig extends WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter { @Override public void addResourceHandlers(Resour

我有一个角形弹簧靴项目,其结构如下图所示:

如您所见,index.html位于resources/static/app下,为了将此位置包含为资源位置,我执行了以下操作:

@Configuration
public class WebMvcConfig extends WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter {


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/app/");
    }
}
现在,当我在默认端口8080上运行我的应用程序时,我得到一个找不到的错误


有人知道我在这里遗漏了什么吗?

因为您正在添加的目录,
app
,已经是默认静态资源目录的子目录:
src/main/resources/static/app
,那么您不需要额外的配置来提供
app
目录中的内容


localhost:8080/app/index.html将在不使用上述附加配置的情况下立即运行。

由于您正在添加目录,
app
,已经是默认静态资源目录的子目录:
src/main/resources/static/app
,那么您不需要额外的配置来提供
app
目录中的内容


localhost:8080/app/index.html将在没有上述附加配置的情况下立即运行。

我删除了配置,但仍然无法运行。当我将index.xml移动到静态时,它就工作了。据了解,只有src/main/resources/static/是spring boot中的内置资源位置,而不是src/main/resources/static/appA资源位置包含其所有子目录,每个子目录都是资源路径中的一部分URL@sansari你的项目中肯定还有别的事情。请在GitHub上分享完整的示例。谢谢。我删除了配置,但仍然无法工作。当我将index.xml移动到静态时,它就工作了。据了解,只有src/main/resources/static/是spring boot中的内置资源位置,而不是src/main/resources/static/appA资源位置包含其所有子目录,每个子目录都是资源路径中的一部分URL@sansari你的项目中肯定还有别的事情。请在GitHub上分享完整的示例。谢谢。你使用什么URL来访问静态内容?我使用,当我将index.html移动到静态目录时它会工作。但当它位于static/app目录下时,它就不起作用了。@AndyWilkinson忘记提到你了。这并不奇怪。当
index.html
位于
src/main/resources/static/app
时,其URL为
localhost:8080/app/index.html
@AndyWilkinson谢谢!那么,当点击localhost:8080时,我如何引导我的应用程序呢?我是否应该将所有调用转发到app/index.html以及如何转发?您使用什么URL访问静态内容?我使用,当我将index.html移动到静态目录时,它会起作用。但当它位于static/app目录下时,它就不起作用了。@AndyWilkinson忘记提到你了。这并不奇怪。当
index.html
位于
src/main/resources/static/app
时,其URL为
localhost:8080/app/index.html
@AndyWilkinson谢谢!那么,当点击localhost:8080时,我如何引导我的应用程序呢?我是否应该将所有呼叫转发到app/index.html以及如何转发?