# spring-boot-restful-template **Repository Path**: yoso2020/spring-boot-restful-template ## Basic Information - **Project Name**: spring-boot-restful-template - **Description**: sprint boot restful API by jwt token with swagger - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-10-16 - **Last Updated**: 2023-05-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Spring boot restful API ### 系统说明 这是一个基于Spring boot + security + JPA + mySql + swagger + JWT token的 restful API系统。 可以作为单纯的API系统使用,也可以集成client(比如angular,Vue, React)一起部署。 ### 注意事项 - pom.xml和application.yml文件里的name等信息需要首先根据实际项目更改 ```xml com.xxxxx xxx-xxxxxx-service xxx xxxx Service A API service for xxx xxx system your-jar-name ``` ```yaml # application.yml spring: application: name: xxx xxxx Service author: www.xxxx.cn ``` - log4j2.yml里的logger name必须根据实际的package路径来修改,否则不能正确的记录日志 ```yaml Loggers: logger: - name: xxx.xxxx # this name should match your package path ``` - 需要RestControllerErrorHandler设置basePackages才能自动处理全部异常 - 只要将angular(或者Vue,React)的output文件放入resource/static目录即可完成client集成 - swagger地址通常为http://server:port/swagger-ui/index.html, swagger在线测试时,Authorize填写token时,token前面需要添加Bearer,例如Bearer youTokenHere - 配置项中的cors为跨域配置,通常如果client集成到本系统里的话,是不需要跨域支持的,则可以禁用 - run locally: java.exe -jar target\package-name.jar - build dev: mvn clean package - build prod: mvn clean package -Pprod - 测试页面:http://localhost:9000/index.html,此页面与API同域,不需要启用cors,如果需要测试跨域支持,可以直接打开src/main/resources/static/index.html文件测试