Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.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
Angular Spring引导始终从index.html提供服务_Angular_Spring Boot - Fatal编程技术网

Angular Spring引导始终从index.html提供服务

Angular Spring引导始终从index.html提供服务,angular,spring-boot,Angular,Spring Boot,我用angular cli创建了一个spring引导项目。输出jar文件如下所示: BOOT-INF |- classes |- com |- static |- index.html 现在,当我转到下面的url http://<ip>:<port> http://: 我被重定向到http://:/app1,因为在我的角度路由中,我将其配置为重定向 但是当我尝试刷新http://:/app1时,我发现4

我用angular cli创建了一个spring引导项目。输出jar文件如下所示:

BOOT-INF
    |- classes
        |- com
        |- static
            |- index.html
现在,当我转到下面的url

http://<ip>:<port>
http://:
我被重定向到
http://:/app1
,因为在我的角度路由中,我将其配置为重定向


但是当我尝试刷新
http://:/app1
时,我发现404未找到。

Spring Boot会自动检测以下位置
public/static/webapp
中的
index.html

如果您有任何控制器专门编写了这样的映射->
@Requestmapping(“/”
),它将覆盖默认行为,并且不会显示
index.html
,除非您路由到
http:\\localhost:8080\index.html

您可能希望在此文件夹结构下创建它

src/main/resources/public/index.html


希望这有帮助

检查这个答案,它会帮助你我试过了,但没有成功