
Java
Java
leo7moon
代码的搬运工
展开
-
windows nginx开放本地文件目录
nginx 开放本地文件目录配置 windows原创 2023-05-05 09:59:25 · 2597 阅读 · 1 评论 -
java sql日志输出过滤
1.mybatis需要实现sql打印只需配置log-impl# mybatis-plusmybatis-plus: mapper-locations: classpath*:com/xxx/**/*Mapper.xml # 扫描 Mapper.xml 的路径 typeAliasesPackage: com.hwasee.jplm.**.entity # 实体扫描,多个package用逗号或者分号分隔 configuration: log-impl: org.apache.ibatis原创 2022-05-11 12:04:48 · 986 阅读 · 0 评论 -
axios和XMLHttpRequest文件下载get post
一、url请求下载态静态资源下载:window.location.href=URLwindow.open(URL)创建 a 标签并指定 a.href=URL 模拟点击进行下载二、axios请求下载(二进制下载)携带token,防止url参数过长将请求的返回结果 XMLHttpRequest.responseType 设置为 blob 用 URL.createObjectURL()和 Blob 处理返回二进制流 然后使用 a 标签模拟点击下载1.后台关键代码controller原创 2022-04-27 16:54:38 · 2267 阅读 · 0 评论 -
nacos1.4.1 windows部署启动
nacos windows部署原创 2022-04-12 22:50:46 · 1049 阅读 · 0 评论 -
推荐几个Java全栈学习的网站
一、学习路线及学习视频1.狂神说https://www.bilibili.com/read/cv5702420?spm_id_from=333.999.0.02.黑马程序员https://zhuanlan.zhihu.com/p/115890802二、Java 全栈知识体系1.https://www.pdai.tech/2.https://how2j.cn/原创 2022-03-19 21:14:58 · 3693 阅读 · 0 评论 -
springboot整合WebSocket:后台服务主动发送信息给前端客户端
1.前端websocket开启方法 // WebSocket接收消息推送 openSocket() { if (typeof WebSocket == "undefined") { console.log("您的浏览器不支持WebSocket"); } else { var socketUrl = `http://localhost:8080/ws/` + this.user.id; socketUrl = socket原创 2022-02-25 16:15:42 · 4690 阅读 · 0 评论 -
关于Oracle数据库varchar2字段超过4000的截取处理
1.问题描述:正式环境的旧系统使用的是oracle数据库,某表remarks备注字段最大长度是varchar2(4000),编码格式为UTF-8,可以存取4000字符和1333个中文字符串。上游系统推送的数据中,remarks的字符长度虽不超过4000字,但包含了中文字符,超过了4000,导致入库失败。经讨论过后,对不重要的字符进行截取入库处理。2.解决方案:截取超出的部分if (StringUtils.lengthOfUTF8(obj.getRemarks()) >= 4000) {原创 2022-02-25 15:46:27 · 4804 阅读 · 0 评论 -
Feign的全局和局部超时配置
方法一:配置bootstrap.yml或application.ymlfeign: hystrix: enabled: false httpclient: enabled: true client: config: default: connectTimeout: 5000 readTimeout: 6000 SysUserClient: #登录操作时长调整为10s,防止超时 readTimeout原创 2022-02-24 11:14:49 · 1288 阅读 · 0 评论 -
swagger groupName分组配置(根据路径或正则表达式过滤分组)
SwaggerConfig.javapackage com.lmp.config;import com.lmp.common.config.Global;import io.swagger.annotations.ApiOperation;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springf原创 2022-02-14 15:24:21 · 2265 阅读 · 0 评论 -
feign传递的数据过长导致Http 400 Bad Request
feign传递参数过长,超出限制!!解决方法:添加请求的大小的限制:(默认值为8k,也就是8 * 1024的大小)server: port: 4371 max-http-header-size: 204800原创 2022-02-07 15:09:15 · 5216 阅读 · 0 评论 -
springboot配置logback.xml(多环境配置)
一、配置dev,pro环境,通过spring.profiles.active属性切换日志配置1.application.yml配置# Spring配置spring: profiles: active: dev# 指定日志配置文件(默认)logging: config: classpath:logback.xml2.application-dev.yml配置# 指定日志配置文件logging: config: classpath:logback-dev.xml3.l原创 2021-11-11 11:00:22 · 4467 阅读 · 0 评论 -
nacos的server-addr地址为域名情况会默认加8848端口
一、本地的nacos:127.0.0.1:8848二、测试环境域名nacos:www.lmptestnacos.cn:80注意:域名后面必须加80端口,不然会被默认添加8848端口原创 2021-11-02 17:02:50 · 6818 阅读 · 5 评论 -
HandlerInterceptor拦截器根据请求类型返回信息或重定向到登录页
package com.test.lmp.interceptor;import org.apache.commons.lang3.StringUtils;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.Configuration;import org.springframework.stereotype.Component;imp原创 2021-10-13 17:39:37 · 2363 阅读 · 0 评论 -
正式环境和开发环境控制swagger开关
1.yml配置文件:#swagger是否激活swagger: enable: true2.SwaggerConfiguration.javapackage com.lmp.config;import io.swagger.annotations.ApiOperation;import org.springframework.beans.factory.annotation.Value;import org.springframework.context.annotation.Bean;原创 2021-06-01 16:03:14 · 1178 阅读 · 0 评论 -
Base64和(BASE64Encoder/BASE64Decoder)比较
一、jdk1.8下的 BASE64Encoder 和 BASE64Decoder(JDK9开始已移除):package com.lmp.utils;import sun.misc.BASE64Decoder;import sun.misc.BASE64Encoder;public class test { public static void main(String[] args) throws Exception { String str = "hello word"原创 2021-05-29 16:38:02 · 10023 阅读 · 0 评论 -
Mysql INSERT INTO SELECT
INSERT INTO c_tmp_institution ( institution_id, institution_code, institution_name, institution_type, STATUS, responsible_person, responsible_phone, juristic_person, province, city, area, town, detail, create_time ) SELECT REPLACE( uuid(),原创 2021-05-20 09:43:12 · 409 阅读 · 0 评论 -
IDEA 使用springboot时不重启即可加载修改的class/html/css/js
一、pom添加热部署包二、修改spring配置不自动重启(要不然老是改一行代码自动重启服务)三、配置springboot更新class和resources四、自动build项目五、编译后重新加载class (最重要也是最容易忽略的一点)六、修改方法内部内容不重启测试:改好代码后:使用快捷键ctrl+shift+f9 重新编译加载这个文件或者单击idea软件外的区域,idea失去焦点后会自动编译和加载修改的java/js/css/html等需要注意的是,如果java添加了方法,原创 2021-04-28 14:35:02 · 1551 阅读 · 0 评论 -
使用递归将List数据组合成树形结构
List全部数据组合成树形结构实体类:package com.test.vo;import lombok.Data;import java.util.List;/** * 国民经济行业分类树形返回参数 * * @author lmp * @date 2021-04-19 */@Datapublic class IndustryVo { private static final long serialVersionUID = 1L; /**ID*/ private St原创 2021-04-19 17:43:31 · 1272 阅读 · 0 评论 -
maven加载jar包到本地repository
一、查找mvn版本信息及安装路径mvn version二、查看maven本地仓库根据上面查找导maven的安装路径D:\java\maven\apache-maven-3.6.3\conf\settings.xml<localRepository>D:/java/maven/repository</localRepository>三、安装jar包到repositorycd C:\Users\Another\Desktop\aamvn install:in原创 2021-03-03 11:25:46 · 386 阅读 · 0 评论 -
idea启动tomcat报错 java.rmi.server.ExportException: Listen failed on port: 0
昨天还好好的项目,突然就报错,启动不了了:C:\Program Files\Java\jdk1.8.0_144\bin\java.exe…错误: 代理抛出异常错误: java.rmi.server.ExportException: Listen failed on port: 0; nested exception is: java.net.SocketException: Operation not supported: JVM_BindProcess finished with exit cod原创 2021-02-22 15:46:32 · 778 阅读 · 0 评论 -
springboot集成Ehcache缓存字典
一、Maven库pom.xml<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId></dependency><dependency> <groupId>net.sf.ehcache</groupId> &原创 2021-01-19 22:43:44 · 785 阅读 · 0 评论 -
MyBatis-Plus QueryWrapper及LambdaQueryWrapper的使用
背景假如我们有一张banner_item表,现需要通过banner_id查出所有数据@Datapublic class BannerItem { private Long id; private String name; private String img; private String keyword; private Integer type; private Long bannerId;}QueryWrapper最基础的原创 2020-12-25 23:04:25 · 14560 阅读 · 0 评论 -
lombok @Accessors简单用法及和Builder
一、@Accessors属性Accessor的中文含义是存取器,@Accessors用于配置getter和setter方法的生成结果,下面介绍三个属性@Data@Accessors(fluent = true)public class User { private Long id; private String name; // 生成的getter和setter方法如下,方法体略 public Long id() {} public User id(原创 2020-12-25 22:56:16 · 1210 阅读 · 0 评论 -
Lombok常用注解
加入 maven 依赖<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.12</version></dependency>1. @Getter/@Setter自动产生 getter/setter2. @ToString自动重写 toS原创 2020-12-25 22:40:54 · 188 阅读 · 0 评论 -
thymeleaf和js的数组冲突问题
背景js中免不了的要用的数组,一维的二维的三维的,但是当用到thymeleaf作为模版时候会有一些坑,导致数组不能用。thymeleaf会把[[]]中的内容作为内联取值块解析,而不是数组。方法一:方法二:添加th:inline="javascript"或者th:inline=“none”,默认是th:inline=“text”<script th:inline="none"></script>...原创 2020-12-25 22:14:27 · 691 阅读 · 0 评论 -
使用navicat快速比对同步2个mysql库的数据及结构
1.单表表结构修改同步语句2.多表表结构同步语句3.两个库数据同步(仅支持小量数据)原创 2020-12-24 01:11:35 · 808 阅读 · 0 评论 -
mybatis-plus 使用In查询
第一种在Dao接口中自定义SQL查询,拼接xml字符串UserDaoMapper.java @Select("<script>" +"select * from user where id in(" + "<foreach item='id' index='index' collection='ids' open='(' separator=',' close=')'>" + "#{id}"原创 2020-12-24 00:33:19 · 37852 阅读 · 11 评论 -
mysql8 递归查询父子集(临时表with recursive temp as)
背景开发过程经常会遇到,需要查询某条记录parent_id相关联的父集数据或子集数据(例如层级数据:地区、菜单、评论、多次回访任务等),可使用mysql8的临时表(with recursive temp as)特性去查询。1、Mysql 中需要使用 WITH RECURSIVE2、Oracle数据库中可使用START [Param] CONNECT BY PRIOR引入计算1到100的累加的结果。WITH RECURSIVE t(n) AS ( //t为我们结果表,n为字段,可以只指定表明不原创 2020-12-23 23:50:49 · 2300 阅读 · 0 评论 -
mysql/oracle使用 navicat比对表数据结构及表结构同步
一、工具–>结构同步二、选择源数据库和目标数据库三、查看比对信息四、同步语句脚本原创 2020-12-16 00:13:08 · 1425 阅读 · 0 评论 -
springboot 集成 mybatis-plus demo
mybatis mybatis-plus代码生成器原创 2020-12-06 00:00:41 · 246 阅读 · 0 评论 -
springboot 集成mybatis demo
mybatis原创 2020-12-05 23:20:15 · 170 阅读 · 0 评论 -
mybatis-plus 更新策略之更新null字段
mybatisPlus 在使用其封装的方法进行更新实体类时,默认是不会去更新null字段的(会更新空字符串"")。然后我们的业务场景中经常会遇到需要更新null的情况,例如日期赋值为null,下面是处理方法:mybatis-plus FieldStrategy 有三种策略:IGNORED:0 忽略NOT_NULL:1 非 NULL,默认策略NOT_EMPTY:2 非空解决方案一1.实体的字段注解添加属性:strategy,但会在查询的时候也会拼接上null:birthday = nul.原创 2020-12-02 14:04:43 · 1581 阅读 · 0 评论 -
5分钟学会使用 redis desktop manager
redis desktop manager原创 2020-11-30 21:48:56 · 166 阅读 · 0 评论 -
redis常用类型(strings、sets、lists、hashes、sorted sets)的相关命令
redis原创 2020-11-29 14:06:42 · 446 阅读 · 0 评论 -
feign接收多个参数
feigin多个参数POST情况下method(String str1,String str2,String str3);method2(String str1,@RequestParam Map<String, Object> map,String str3);1.APIpackage com.hwasee.hsc.api.redis;import org.springframework.web.bind.annotation.PostMapping;import org.spr原创 2020-11-26 12:58:00 · 1475 阅读 · 0 评论 -
Requested bean is currently in creation: Is there an unresolvab circular reference?
关于Feign的一个bug,A服务的拦截器调用B服务,A服务启动时报bugorg.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'springApplicationAdminRegistrar': Singleton bean creation not allowed while singletons of this factory are in destructio原创 2020-11-25 19:17:51 · 2022 阅读 · 8 评论 -
springboot整合swagger2-2.9.2和swagger2-UI-1.9.6图形化超简单demo
一、搭建环境1.目录:2.pom.xml<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.ap原创 2020-10-31 02:31:58 · 763 阅读 · 0 评论 -
ServletContextListener使用详解(监听Tomcat启动、关闭)
在 Servlet API 中有一个 ServletContextListener 接口,它能够监听 ServletContext 对象的生命周期,实际上就是监听 Web 应用的生命周期。当Servlet 容器启动或终止Web 应用时,会触发ServletContextEvent 事件,该事件由ServletContextListener 来处理。在 ServletContextListener 接口中定义了处理ServletContextEvent 事件的两个方法。 java代码/** * 当原创 2020-09-24 14:50:40 · 1689 阅读 · 0 评论