2021
01-29
01-29
解决springboot bean中大写的字段返回变成小写的问题
例如我的bean中有以下4个字段privateStringcode;privateString_TOKENUUMS;privateStringTGC;privateStringU;在返回的json里只会显示{“code”:“xx”,“tgc”:“xx”,“u”:“xx”}大小会变成小写,特殊符号开头的字段都不会显示,其原因是因为springboot在进行序列化和反序列时对字段进行了处理。解决方案是:importcom.fasterxml.jackson.annotation.JsonProperty;在get方法上加上该注解@JsonPropertyprivateStringco...
继续阅读 >
一、背景单机节点下,WebSocket连接成功后,可以直接发送消息。而多节点下,连接时通过nginx会代理到不同节点。假设一开始用户连接了node1的socket服务。触发消息发送的条件的时候也通过nginx进行代理,假如代理转到了node2节点上,那么node2节点的socket服务就发送不了消息,因为一开始用户注册的是node1节点。这就导致了消息发送失败。为了解决这一方案,消息发送时,就需要一个中间件来记录,这样,三个节点都可以获取消息,然...
maven导入依赖<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-...
简介前面个已经讲过mybatis的批量更新操作。批量操作还有时分页查询,针对项目的完善性,来讲解一下分页工具的植入pagerHelper和tk.mybatis使用。其实官网已经有具体代码,代价有空可以多多参考官网操作。链接地址MyBatis-Spring-Boot技术方案mavenjar导入查看官方说明引入依赖,如下:<!--mybatis--><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version...
1.部署方式Springboot和普通web应用程序不一样,其本质上是一个Java应用程序,那么又如何部署呢? 通常来说,Springboot部署会采用两种方式:全部打包成一个jar,或者打包成一个war。现在讲一下打包成jar部署。2.打包成jar 第一种方法(idea)1.clean2.package第二种方法(命令行):键盘输入windows+r:cd命令切换到你项目所在路径:online是我的项目名称,这里换成你自己的,可以看到当前是没有ta...
依赖<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!--Thymeleaf--><dependency><groupId>org.thymeleaf</groupId><artifactId>thymeleaf-spring5</artifactId></dependency><dependency><groupId>org.thymeleaf.extras</groupId><artifactId>thymeleaf-extras-java8time</artifactId></dependency><!--SpringSec...
一:在springboot中使用事物遇到的坑1.我们知道spring中的事物分为两种:一种是编程式事物,一种是声明式事物。顾名思义,编程式事物是指通过代码去实现事物管理,这里不做过多说明。另一种是声明式事物,分为两种情况01:一种是通过传统xml方式配置,02:使用@Transaction注解方式配置,这是主要讲解的是通过注解方式配置。因为在springboot项目中,会自动配置DataSourceTransactionManager,我们只需要在对应的方法上或者类上加...
目录结构如下在自己配置的ShiroConfig中已经放行了filterChainDefinitionMap.put("/static/**","anon");login.ftl也引用了静态资源<linkrel="stylesheet"type="text/css"href="/logins/css/normalize.css"rel="externalnofollow"/><linkrel="stylesheet"type="text/css"href="/logins/css/demo.css"rel="externalnofollow"/><linkrel="stylesheet"href="/logins/js/vendor/jgrowl/css/jquery.jgrowl.min.css"rel="...
场景重现:1.微信小程序向后台发送请求——而后台web采用的springSecuriry没有token生成,就会拦截请求,,所以小编记录下这个问题微信小程序授权登录问题思路参考网上一大堆资料核心关键字:自定义授权+鉴权(说的通俗就是解决办法就是改造springSecurity的过滤器)参考文章https://www.jb51.net/article/204704.htm总的来说的通过自定义的WxAppletAuthenticationFilter替换默认的UsernamePasswordAuthenticationFilter,在Use...