Angular Spring引导始终从index.html提供服务
我用angular cli创建了一个spring引导项目。输出jar文件如下所示: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
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
希望这有帮助 检查这个答案,它会帮助你我试过了,但没有成功