SpringBoot后端统一格式返回
摘要:GitHub地址 统一结果一般形式: 状态码 描状态码述 响应数据 结果类枚举: @Getter public enum ResultEnum { SUCCESS(200,"成功"), UNEXIST_URL(404,"URL不存在"), UNEXIST_ERROR(404,"用户不存在或密码有误"
阅读全文
posted @
2020-04-04 00:08
陌生街中吹起褪色故梦
阅读(420)
推荐(0) 编辑
SpringBoot集成JWT
摘要:GitHub下载地址 JWT请求流程 JWT验证登录的答题思路: 1、用户输入用户名和密码,POST请求去登陆,验证无误后,JWT创建token返回给客户端。 2、客户端将token存储在浏览器的cookie,前台发送请求要在Header携带token。 3、后台使用拦截器,拦截有@UserLogi
阅读全文
posted @
2020-04-01 23:09
陌生街中吹起褪色故梦
阅读(177)
推荐(0) 编辑
SpringBoot 中通过 CORS 解决跨域问题
摘要:同源策略SOP(Same Origin Policy) 源(origin)就是协议(http)、域名(localhost)和端口号(8080),同源是指协议、域名以及端口要相同。 No 'Access-Control-Allow-Origin' header is present on the re
阅读全文
posted @
2020-02-15 23:32
陌生街中吹起褪色故梦
阅读(172)
推荐(0) 编辑
SpringBoot 打包
摘要:一、jar 1、pom.xml 2、mvn命令行打包jar mvn clean install -Dmaven.test.skip=true 3、运行 java -jar 包名.jar 二、war 1、pom.xml 2、排除内置的Tomcat容器 3、修改启动类 4、mvn命令打包war mvn
阅读全文
posted @
2019-08-05 15:55
陌生街中吹起褪色故梦
阅读(193)
推荐(0) 编辑
Angular2发送HTTP请求SpringBoot后台跨域问题解决
摘要:Angular通过http发送post请求至SpringBoot的Controller,由于同源策略的保护,遇到跨域问题: • 源(origin)就是协议(http)、域名(localhost)和端口号(8080),若地址里面的协议、域名和端口号均相同则属于同源 解决方法:SpringBoot增加跨
阅读全文
posted @
2019-03-07 11:04
陌生街中吹起褪色故梦
阅读(1027)
推荐(0) 编辑
SpringBoot中Example的动态条件查询
摘要:一、无匹配器的情况: Person person = new Person(); person.setName("test"); Role role = new Role(); role.setName("经理"); person.setRole(role); ... Example<Person>
阅读全文
posted @
2018-12-03 16:26
陌生街中吹起褪色故梦
阅读(10325)
推荐(2) 编辑
SpringBoot导入Excel数据到MySQL数据库
摘要:1 import com.example.example1.Entity.User; 2 import com.example.example1.Service.UserRepository; 3 import org.apache.poi.hssf.usermodel.*; 4 import or
阅读全文
posted @
2018-12-03 14:44
陌生街中吹起褪色故梦
阅读(4273)
推荐(0) 编辑