自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

春盏

安居不用架高堂,书中自有黄金屋。娶妻莫恨无良媒,书中自有颜如玉。

  • 博客(74)
  • 收藏
  • 关注

原创 Error attempting to get column ‘xxxx_time‘ from result set. Cause: java.sql.SQLFeatureNotSupportedEx

Error attempting to get column 'xxxx_ime' from result set. Cause: java.sql.SQLFeatureNotSupportedException; null; nested exception is java.sql.SQLFeatureNotSupportedException] with root cause

2022-09-11 16:49:38 605 1

原创 mybatisplus querywrapper拼接where语句,查询json数组

mybatisplus querywrapper拼接where语句,与MySQL查询json数组

2022-06-20 15:57:49 5922

原创 更改Centos的yum源为国内的阿里云源

备份yum源mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup下载阿里云源wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo清空缓存yum makecache

2022-04-14 14:22:03 1473

原创 -bash: wget: 未找到命令

在虚拟机中利用wget命令下载安装相关应用时,提示:-bash: wget: 未找到命令问题原因:服务器本身没有自带安装wget,但一般很少有这种情况出现。 服务器自带的wget版本过低,无法通过wget命令去安装其它应用。.解决:1. 查看服务器是否安装wgetrpm -qa|grep 'wget'如果有,则执行第2步;如果没有,则执行第3步。2. 卸载wgetyum remove wget3.下载wget的rpm安装包http://mirrors.1.

2022-04-14 14:18:46 11018 5

原创 centos7离线安装redis5.0

1. gcc依赖没有gcc环境就执行下面的命令,有就忽略。yum install -y gcc-c++2. redis资源包下载地址:redis5.0· xftp上传至/usr/local 目录下· 解压:tar -zxvf /usr/local/redis-5.0.4.tar.gz· 进入目录: cd /redis-5.0.43. 编译安装# 编译make# 安装到指定目录make PREFIX=/usr/local/redis install4..

2022-04-09 15:25:15 2024 1

原创 -bash: netstat: command not found

yum install net-tools -y

2022-04-09 14:48:13 876

原创 centos7断网安装MySQL5.7

一、安装包准备libaio-0.3.109-13.el7.x86_64.rpm链接:https://pan.baidu.com/s/1OWPLPEoEUWvlZ5rZjhAD0w 提取码:zswbmysql-5.7.35-linux-glibc2.12-x86_64.tar.gz链接:https://pan.baidu.com/s/1l8mC-UEOnKNPto1i2krI_g 提取码:ow5u二、解压、创建目录通过xftp或者其他工具上传到 /usr/loc...

2022-02-24 15:05:48 692

原创 SpringCloud学习[10]-consul集群搭建与修改默认端口

一、集群搭建· 环境准备ssh shell 工具:远程连接三台centos7服务器:192.168.200.241、192.168.200.242、192.168.200.243·下载安装启动consulconsul安装启动https://blog.csdn.net/qq_31832209/article/details/118092030·集群启动(这里与上文连接启动有点不同,集群用server)192.168.200.241 启动consulconsul agent -

2022-02-23 13:33:25 3758

原创 Java将byte[]转String只保留有效长度的字符串

今天在开发中遇到一个奇怪的问题,substring()方法竟然失败了!!!public boolean insertMessage(String message) { log.info("报文:" + message); message = message.toUpperCase(); //截取真正报文部分 String msg = message.substring(4, message.length() - 4); log.info(msg);}仔细看了一

2021-07-27 10:10:34 590

原创 Java判断List集合中是否包含某个元素

在日常开发中,经常会遇到判断list集合中包含某个元素的额需求,特此记录。使用for循环public class ListTest { public static boolean loop(List<String> list, String value) { for (String str : list) { if (Objects.equals(str, value)) { return true;

2021-07-26 11:31:23 56303 1

原创 SpringCloud学习[9]-OpenFeign组件之日志

OpenFeign伪HttpClient客户端对象,用来帮助我们完成服务间通信,底层使用http协议完成服务间调用。日志:为了更好的方便在开发过程中调试OpenFeign数据传递和响应处理,OpenFeign团队在设计时添加了日志功能。默认日志功能需要手动开启。说明往往在服务调用时我们需要详细展示feign的日志,默认feign在调用时并不是最详细日志输出,因此在调式程序时应该开启feign的详细日志展示。feign对日志的处理灵活可为每个feign客户端指定日志策略,每个客户端都会创建一个logge

2021-07-19 13:12:50 227 2

原创 SpringCloud学习[8]-OpenFeign组件服务间调用之响应处理与默认超时处理

四、OpenFeign服务间调用之响应处理1. 调用服务返回对象被调用Share服务定义一个返回对象的接口@RestController@RequestMapping("shareConApi")public class ShareController { private static Logger log = LoggerFactory.getLogger(ShareController.class); @GetMapping("findMember/{id}")

2021-07-19 11:40:04 504

原创 MyBatis中的转义字符

在MyBatis中,经常用到动态sql。Mybatis使用的 *.xml文件格式,需要对有些字符进行转义。1. 转义方式字符转义符号备注<<小于<=<=小于等于>>大于>=>=大于等于<><>不等于&&与’'单引号”"双引号mapper.xmlselect t.* form table t where t.sta

2021-07-06 15:09:12 27231 1

原创 SpringCloud学习[7]-OpenFeign组件服务间调用之参数传递

三、OpenFeign服务间调用之参数传递1. 微服务架构服务间通讯方式http协议springcloud两种方式: 1. RestTemplate + Ribbon 2. OpenFeign(推荐)2. 服务间通信参数传递参数传递类型零散类型对象类型数组或集合类型参数零散类型参数传递QueryString方式传递参数:?name=zhangsan&age=20被调用Share服务定义一个接受零散参数类型的接口QueryString@RestControlle

2021-07-01 14:23:34 3224

原创 SpringCloud学习[6]-OpenFeign组件服务间通信

使用RestTemplate+ribbon已经可以完成对服务间的调用,为什么还要使用feign?String getResult = restTemplate.getForObject(“http://{{服务ID}}/{{url}}”, String.class);存在问题每次调用服务都需要写这些代码,存在大量的代码冗余服务地址如果修改,维护成本增高不能自动转换响应结果为对应对象必须集成ribbon实现负载均衡OpenFeign组件一、简介1. 发展Feign组件 ---

2021-07-01 13:28:43 192

原创 SpringCloud学习[5]-使用RestTemplate微服务间通信和Ribbon负载均衡组件

一、什么是微服务微服务简言之就是基于单体应用围绕业务进行服务拆分出来每一个服务独立应用,独立部署、独立运行在自己的计算机进程中,基于分布式管理。二、如何解决微服务间通信HTTP Rest方式 :使用http协议进行数据传递 (JSON数据)RPC方式 : 远程过程调用 (二进制)OSI七层:物理层 数据链路层 网络层 传输层(rpc) 会话层 表示层 应用层(http)springcloud使用http协议传递数据三、如何在Java中发起http方式的请求网络编程spr

2021-06-29 14:42:38 328

原创 Spring Boot启动时自动运行自定义方法

在springBoot中我们有时候需要让项目在启动时提前加载相应的数据或者执行某个定时任务,那么实现启动时自动运行自定义方法的方式有哪些呢?实现 CommandLineRunner 接口@Componentpublic class TestStart implements CommandLineRunner { @Override public void run(String... args) throws Exception { System.out.println

2021-06-28 17:32:38 549

原创 在虚拟机中docker创建mongo容器失败

docker run -d -p 27017:27017 -v /home/mongodb/configdb:/data/configdb -v /home/mongodb/db:/data/db --name mongo docker.io/mongo查看docker启动容器 docker ps查看mongo日志,失败原因chown: changing ownership of ‘/data/configdb’: Permission deniedchown: changing owners.

2021-06-28 17:07:56 454

原创 SpringCloud学习[4]-服务发现consul

定义Consul是HashiCorp公司推出的开源工具,用于实现分布式系统的服务发现与配置。 Consul是分布式的、高可用的、可横向扩展的。它具备以下特性:service discovery:consul通过DNS或者HTTP接口使服务注册和服务发现变的很容易,一些外部服务,例如saas提供的也可以一样注册。health checking:健康检测使consul可以快速的告警在集群中的操作。和服务发现的集成,可以防止服务转发到故障的服务上面。key/value storage:一个用来存储动态

2021-06-22 17:23:49 416 1

原创 consul服务注册出现consul dial tcp: lookup : no such host问题

问题此时查看服务注册时打印的控制台日志Registering service with consul: NewService{id='SHOP-8081', name='SHOP', tags=[secure=false], address='YINGKONG-HP2020', meta={}, port=8081, enableTagOverride=null, check=Check{script='null', dockerContainerID='null', shell='null', in

2021-06-22 17:21:07 8079

原创 SpringCloud学习[3]-SpringCloud服务注册中心组件eureka

服务注册中心定义所谓服务注册中心就是在整个微服务架构中单独提出一个服务,这个服务不完成系统的任何业务功能,jin'jin'yong'lai

2021-06-18 14:31:19 211

原创 SpringCloud学习[2]-SpringCloud环境搭建

版本选择spring boot 2.2.5.RELEASEspring cloudHoxton.SR6jdk8maven 3.6

2021-06-17 11:31:26 84

原创 SpringCloud学习[1]-微服务与SpringCloud了解

一、微服务二、SpringCloud

2021-06-04 14:23:24 518 5

原创 Idea自动部署SpringBoot jar包到centos服务器并脚本启动

1. idea连接centos服务器Tools->Deployment->Configuration2. 查看remote hostTools->Deployment->Browse Remote Host3. jar上传至centos# 可以通过项目jar右击deployment上传jar到服务器,此时jar会上传到第一步图三中配置的目录下。# 我更喜欢直接从把jar拖动到remote host以上两种方式,都会出现tra

2021-05-27 11:32:52 458

原创 Linux发布Java项目jar脚本

#!/bin/bash#description: 启动重启 jar 服务#端口号,根据此端口号确定PIDPORT=7777#启动命令所在目录#HOME='/usr/etc/server/java/server' #查询出监听了PORT端口TCP协议的程序#pid=`netstat -anp|grep $PORT|awk '{printf $7}'|cut -d/ -f1`pid=`lsof -i:$PORT|awk '{printf $2}'|cut -d/ -f1`#截取字.

2021-05-26 10:46:35 329

原创 SpringBoot多模块项目打包失败 Unable to find main class

spring boot多模块项目打包失败:[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.2.RELEASE:repackage (repackage) on project xxx: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.2.RELEASE:repacka

2021-05-25 18:10:31 948

原创 RabbitMQ学习笔记[7]-SpringBoot整合RabbitMQ

一、环境搭建1. 引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency>2. 配置环境spring: application: n

2021-05-24 11:01:51 111 1

原创 SpringBoot测试类不需要加@RunWith?

# 在idea中,自动生成的测试类没有@RunWith运行正常?在SpringBoot2.2.0以前是JUnit4,在SpringBoot之后是JUnit5。Juint版本说明Junit4<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13</version> <scope&g

2021-05-21 17:25:02 1989

原创 SpringBoot添加jsp支持

1. pom添加依赖 <!--内置tomcat对Jsp支持的依赖,用于编译Jsp--> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency>2.a.

2021-05-21 16:09:16 98

原创 RabbitMQ学习笔记[6]-RabbitMQ消息模型-Routing订阅模型Direct与Topic

一、Routing之订阅模型-DirectWe were using afanoutexchange, which doesn't give us much flexibility - it's only capable of mindless broadcasting.We will use adirectexchange instead. The routing algorithm behind adirectexchange is simple - a message goes ...

2021-05-21 16:03:52 157

原创 RabbitMQ学习笔记[5]-RabbitMQ消息模型-Fanout广播模型

The core idea in the messaging model in RabbitMQ is that the producer never sends any messages directly to a queue. Actually, quite often the producer doesn't even know if a message will be delivered to any queue at all.Instead, the producer can only se.

2021-05-19 11:02:58 103

原创 RabbitMQ学习笔记[4]-RabbitMQ消息模型-消息持久性

前一篇【消息自动确认机制】学会了如何确保即使消费者死亡,任务也不会丢失。但是,如果RabbitMQ服务器停止,我们的任务仍然会丢失。When RabbitMQ quits or crashes it will forget the queues and messages unless you tell it not to. Two things are required to make sure that messages aren't lost: we need to mark both the q

2021-05-17 16:06:57 117

原创 RabbitMQ学习笔记[3]-RabbitMQ消息模型-work消息模型与消息自动确认机制

The main idea behind Work Queues (aka:Task Queues) is to avoid doing a resource-intensive task immediately and having to wait for it to complete. Instead we schedule the task to be done later. We encapsulate ataskas a message and send it to a queue. A ...

2021-05-17 12:26:48 208 2

原创 RabbitMQ学习笔记[2]-RabbitMQ消息模型-基本消息模型

RabbitMQ is a message broker: it accepts and forwards messages. You can think about it as a post office: when you put the mail that you want posting in a post box, you can be sure that Mr. or Ms. Mailperson will eventually deliver the mail to your recipie.

2021-05-13 17:04:50 135 3

原创 RabbitMQ学习笔记[1]-初识与安装RabbitMQ

一、MQ1. MQ定义MQ(Message Queue):翻译为消息队列,典型的生产者和消费者模型,生产者不断向消息队列中生产消息,消费者不断从队列中获取消息。因为消息的生产和消费都是异步的,而且只关心消息的发送和接收,没有业务逻辑的侵入,轻松实现系统间的解耦。别名为消息中间件,统过利用高校可靠的消息机制进行平台无关的数据交流,并基于数据通信来进行分布式系统的集成。2. MQ都有哪些主流的消息中间件,如传统的ActiveMQ、RabbitMQ,炙手可热的Kafka,阿里巴巴的Rocket

2021-05-13 16:39:24 116 1

原创 nginx下载文件,阻止浏览器自动打开文件

在我的项目中,采用的是fastdfs+nginx上传、下载文件。想要下载文件,只需在nginx中添加add_header Content-Disposition "attachment;"// 所有文件都不打开location / { add_header Content-Disposition "attachment;";}fastDFS上传的文件都不会用原来的名字,所以下载的时候需要改名,可通过url中添加参数,然后在nginx中根据参数来改名。例:attname...

2021-05-13 15:15:14 1471

原创 centos docker安装mongodb

1. 拉取镜像docker pull mongo2. 创建挂载目录mkdir -p /home/mongodb/configdbmkdir -p /home/mongodb/db3. 运行容器docker run -d -p 27017:27017 -v /home/mongodb/configdb:/data/configdb -v /home/mongodb/db:/data/db --name mongo docker.io/mongodocker ps 查看m

2021-05-10 10:56:35 519

原创 centos防火墙

1. 查看firewalld状态systemctl status firewalld2. 开启防火墙,没有任何提示即开启成功。systemctl start firewalld3. 查看firewalld状态,显示running即已开启了。systemctl status firewalld4. 关闭防火墙systemctl stop firewalld5. 防火墙设置#添加(--permanent永久生效,没有此参数重启后失效)firewall-c

2021-05-10 10:34:45 113

原创 Java 网络资源url转file文件

package org.chuancey.utils;import lombok.extern.slf4j.Slf4j;import java.io.File;import java.io.FileOutputStream;import java.io.InputStream;import java.net.URL;@Slf4jpublic class FileUtil { /** * @param fileUrl 资源地址 * @Description:.

2021-05-08 15:14:11 3502 1

原创 Java中实现跨域的五种方式

一、什么是跨域?为什么会出现跨域定义:当一个请求url的协议、域名、端口三者之间任意一个与当前页面url不同即为跨域。原因:在前后端分离的模式下,前后端的域名是不一致的,此时就会发生跨域访问问题。在请求的过程中我们要想回去数据一般都是post/get请求,所以..跨域问题出现。跨域问题来源于JavaScript的同源策略,即只有 协议+主机名+端口号(如存在)相同,则允许相互访问。也就是说JavaScript只能访问和操作自己域下的资源,不能访问和操作其他域下的资源。跨域问题是针对JS和aja

2021-05-08 14:51:45 15057 2

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除