ant design java_SpringBoot整合Ant Design Pro进行部署

本文介绍了如何将Ant Design Pro与SpringBoot项目结合,包括打包Ant Design Pro的静态文件,配置SpringBoot访问静态资源,处理路由问题,以及解决404错误。通过设置,实现了访问SpringBoot应用时展示Ant Design Pro页面并正确加载资源。
摘要由CSDN通过智能技术生成

一、Ant Design Pro 打包

1.1 运行 build打包

$ npm run build

1.2 将打包生成的静态文件拷贝到spring boot 项目中

构建打包成功之后,会在根目录生成 dist 文件夹,然后将dist 文件夹里的的文件复制到 spring boot 项目的 /src/main/resources/static 目录下

3f0bd462cc69539862f958398b046d5f.png

二、配置spring boot 项目可访问到static目录下的index.html

2.1 以gradle为例导入spring-boot-starter-thymeleaf

compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.1.5.RELEASE'

2.2 在application.yml配置文件中配置

#配置html资源路径

spring:

thymeleaf:

prefix: classpath:static/

2.3 在controller配置访问地址

/**

@author Alan Chen

@description 拦截Ant Design Pro访问路径

@date 2019/5/24*/

@Controllerbr/>*/

@Cont

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值