- 博客(90)
- 收藏
- 关注
原创 oracle 连接
命令行连接 oracle 并创建新用户。$ sqlplus sys/sys as sysdba// 创建用户并设置密码create user c##test identified by test;// 设置权限并提交grant create session to c##root;grant create table to c##root;grant unlimited tablespace to c##root;commit; 用 oracle sql develope..
2021-07-16 16:32:14
127
原创 rocketmq 安装和使用常见问题解决
运行 docker-compose 时,error pulling image configuration XXXX x509: certificate has expired or is not yet valid,可能是虚拟机和宿主机时间不同步导致。# 查询虚拟机时间$ date# 下载yum install ntpdate# 同步宿主机时间ntpdate cn.pool.ntp.org connect 10911 failed。 broker.conf 里:# .
2021-07-15 10:41:26
414
原创 数据库树形结构表查询处理
数据库结构。 代码结构。 SpringBoot 工程。// pom.xml<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <depe..
2021-06-03 14:34:02
298
1
原创 java 枚举和枚举工具类
定义枚举接口类。// Enum 枚举的 公共接口public interface EnumManager { Integer getState(); String getName();} 枚举类。//public enum AssetSource implements EnumManager { SOURCE_BUY(1, "购入"), SOURCE_RENT(2, "租赁"); private final Integer s..
2021-06-02 20:13:29
218
原创 spring cloud 常用依赖和配置整理
// 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 http://maven.apa...
2021-05-26 23:40:07
693
3
原创 dubbo 快速入门
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210408222032412.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xpdTFzaGk=,size_16,color_FFFFFF,t_70#pic_center) dubbo 文档,添加链接描述,https://dubbo.apache.org/.
2021-04-08 22:51:16
85
原创 fastdfs 文件分布式存储
docker 容器管理平台。链接,https://hub.docker.com。 找到 ygqygq2/fastdfs-nginx 。 安装。// 示例中创建了网卡,我们直接用已有的 host 网卡就好// 查询已有网卡docker network ls// 搜索容器docker search fastdfs// 拉取镜像docker pull ygqygq2/fastdfs-nginx// 运行 trackerdocker run -dit --netwo..
2021-04-06 20:15:34
216
原创 WebSocket 使用
新建一个 websocket 模块。 工程目录。// pom.xml<!-- 改为 war 包 --> <packaging>war</packaging> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artif..
2021-03-19 20:28:34
213
原创 存储用户访问数据到日志中
在 zuul 网关中获取到用户访问的数据,保存到 es 中。服务间的交互采用 stream。 spring cloud 工程。 search 模块。 虚拟机中开启 rabbitmq 和 elasticsearch。// pom.xml<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-b..
2021-03-17 22:09:36
177
原创 使用 jjwt 做 token 认证
采用 springcloud 微服务。 创建父工程。// pom.xml 部分代码 <packaging>pom</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <..
2021-03-16 20:56:02
399
原创 分布式锁、分布式定时任务、分布式事务
在分布式环境下,传统的一些技术会失败,比如传统的 synchronized 或者 lock 锁,以及创建数据库的事务,无法保证ACID,还有定时任务也可能会出现重复执行的问题。 分布式锁。Zookeeper 实现分布式锁。 创建 spring boot 工程。// pom.xml <dependency> <groupId>org.apache.zookeeper</groupId> <art..
2021-03-11 20:14:18
418
原创 Zookeeper 的使用
Zookeeper 是一个文件系统 + 监听通知机制。使用在 Java 分布式架构中。 Zookeeper 的结构。 每一个节点都被称为 znode。 每一个 znode 中都可以存储数据。 节点名称不允许重复。 四种 Znode。 持久节点,永久的保存在你的 Zookeeper。 持久有序节点,永久的保存在你的Zookeeper,他会给节点添加一个有序的序号。 临时节点,当存储的客户端和 Zookeeper 服务断开连接时,这个临时节点自动删除。 临时有序节点,..
2021-03-10 09:29:05
101
原创 SpringCloud 微服务搭建和使用 二
客户模块间通过 RestTemplate 调用。customer 调用 search。 customer 在 application 里添加 bean。 @Bean @LoadBalanced // 负载均衡 默认轮询 public RestTemplate getTemplate() { return new RestTemplate(); } controller 里调用。@RestController@RequestMapping(..
2021-03-08 21:26:18
114
原创 SpringCloud 微服务搭建和使用
微服务架构是将一个完整的项目,拆分成多个模块去分别开发。 SpringCloud 是微服务架构落地的一套技术栈。 SpringCloud 的八个技术点。 Eureka,服务的注册与发现; Robbin,服务之间的负载均衡; Feign,服务之间的通讯; Hystrix,服务的线程隔离以及断路器; Zuul,服务网关; Stream,实现MQ的使用; Config,动态配置; Sleuth,服务追踪。 Eureka 帮助我们维护所有服务的信息,以便服务之间的..
2021-03-05 22:35:51
176
3
原创 RabbitMQ 应用
消息确认机制。// 普通Confirmpublic class Publish1 { @Test public void testPublish() throws IOException { // 普通Confirm, confirm 只能确认消息有没有到达 exchange 无法保证是否到达queue Connection connection = RabbitConfig.getConnection(); Chann..
2021-03-04 22:33:26
71
1
原创 RabbitMQ 基本使用
RabbitMQ 主要解决模块之间耦合度过高问题。 安装 RabbitMQ。 linux 下使用 docker-compose 安装。# docker-compose.ymlversion: "3.1"services: rabbitmq: image: daocloud.io/library/rabbitmq:management restart: always container_name: rabbitmq ports: - 5..
2021-03-03 22:49:56
131
4
原创 SpringBoot 应用练习
新建两个项目。一个项目做 ES 的查询和添加。一个中转项目连接 ES 项目,查询 ES 和 添加数据库的同时向 ES 中添加。 ES 项目。 项目目录。 打开 ES 服务器。// 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-i..
2021-03-02 21:32:36
88
1
原创 SpringBoot 配置和使用
SpringBoot 并不是一门新技术,只是将之前常用的Spring,SpringMVC,data-jpa等常用的框架封装到了一起,帮助你隐藏这些框架的整合细节,实现敏捷开发。 SpringBoot 就是一个工具集。 IDEA 创建 SpringBoot项目。 修改。 Demo 工程目录。// HelloController.java@RestController@RequestMapping("/test")public class HelloControll..
2021-03-01 22:17:27
234
原创 Java 操作 ElasticSearch 的更多查询
@Test public void t15() throws IOException { DeleteByQueryRequest request = new DeleteByQueryRequest(index); request.types(type); // 删除查询到到数据 request.setQuery(QueryBuilders.rangeQuery("fee").lt(5)); BulkByS...
2021-02-27 16:59:35
443
原创 Java 操作 ElasticSearch
使用 kibana。 当创建索引并填充数据后,可以在 Discover 里查看。 代码结构。// man.java@Data@AllArgsConstructor@NoArgsConstructorpublic class Man implements Serializable { private Integer id; private String name; private Integer age; private String ..
2021-02-26 23:00:23
370
原创 Redis 哨兵、集群,ElasticSearch 安装和使用
Redis 主从架构。 这种架构,主节点可以读写,从节点只能读。当主节点挂掉后,整个 redis 服务就不可用了。 哨兵。 哨兵可以解决主从架构中的单点故障问题。就是添加的 sentinel1 、sentinel2、sentinel3文件映射。当主节点出现故障时,其中的从节点会成为主节点。version: '3.1'services: redis1: image: daocloud.io/library/redis:5.0.7 restart: always..
2021-02-25 21:28:04
255
原创 Java 连接 Redis
工程目录。// pom.xml<dependencies> <!-- 1、 Jedis--> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</v..
2021-02-24 23:51:34
54
原创 Nginx、Redis的安装和使用
Nginx 用来处理服务器代理问题、负载均衡问题、资源优化。 使用 docker-compose 安装 Nginx。cd /optmkdir docker_nginxvi docker-compose.yml// -d 后台运行docker-compose up -d docker-compose.yml 文件内容。version: '3.1'services: nginx: restart: always image: daocloud.io/..
2021-02-23 20:53:14
859
原创 Jenkins 配置、使用和自动构建项目
持续集成,Continuous Integration,简称CI,是一种软件开发实践,在实践中指只要代码有变更,就自动运行构建和测试。 Jenkins 是一个开源的、提供友好操作界面的持续集成 CI 工具。 部署流程。 用户提交代码到 Git 仓库; Jenkins 服务器从指定 Git 仓库拉去代码,使用 maven 编译打包。 Jenkins 服务器 ssh 连接应用服务器,将打包好的 war 或者 jar 包传送到应用服务器指定位置,例如 tomcat/webapps..
2021-02-22 22:59:46
187
原创 微信小程序手势密码功能
资源。 效果。 代码结构。 主体代码。 组件 component。// ssmm.json{ "component": true, "usingComponents": {}}// ssmm.wxss.w100{width:100%;}.h100{height:100%;}.w33{width:33.3%;}.h33{height:33.3%;}.flexCenter { display:flex; flex-direction:row..
2021-02-09 18:02:01
971
原创 iOS、OC 手势密码功能
资源。 效果。 代码结构。 主体代码。// SsmmView.h#import <UIKit/UIKit.h>@class SsmmView;NS_ASSUME_NONNULL_BEGIN@protocol SsmmViewDelegate <NSObject>- (void)ssmmView:(UIView *)view passwordString:(NSString *)string;@end@interface Ss..
2021-02-07 16:03:05
288
1
原创 mac 下 linux 虚拟机的简单安装和使用
下载VMware Fusion(链接,https://www.vmware.com/)。 下载 linux 虚拟机的镜像 CentOS-7.iso,下载简版的就行。 将 CentOS-7.iso 拖到 VMware 里安装,要求至少预留20G 硬盘空间,安装时可以选择安装到移动硬盘上。注意安装时要选择中文语言、打开以太网络和设置密码。 使用终端连接虚拟机。// linux 下, 查询 linux ip ip a// mac 下,右键终端 -> 新建远程连接,然后可以在终端..
2021-02-04 22:49:51
1591
原创 IDEA 快捷键
command + r,查找和替换。 command + n,文件上按,新建包和文件;文件内按,建立set、get、构造方法等。 command + d,复制一行或所选。 command + delete,删除一行或所选。 command + /,单行注释。 alt + command + /,多行注释,选中包含在注释内。 alt + command + L,格式化代码。 alt + command + t,if、while、for、try catch等。 alt +..
2021-02-01 21:19:55
113
原创 IDEA 连接数据库反射实体类
IDEA 连接数据库反射entity、dao层、mapper。// pom.xml<build> <plugins> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</arti..
2021-01-28 21:16:52
331
原创 SpringMVC 关联使用 quartz、layui 数据列表和分页功能
SpringMVC 关联使用 quartz。// pom.xml<properties> <springframework.version>5.1.6.RELEASE</springframework.version> <quartz.version>2.2.3</quartz.version> </properties> <dependencies> ..
2021-01-27 21:04:21
164
原创 Log、Quartz的使用
日志,用于记录系统中发生的各种事件。记录的位置常见的有控制台、磁盘文件。 Log4j+Commons-Logging。// pom.xml<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependen..
2021-01-26 21:24:27
685
1
原创 SpringMVC 框架的使用2
@RestController,Controller 类上加了@RestController 注解,等价于在类中的每个方法上都加了@ResponseBody,全局返回 json 数据。// JsonRestController.java@RestController@RequestMapping("/jsonrest")public class JsonRestController { @RequestMapping("/demo1") public User demo..
2021-01-25 23:41:48
78
原创 SpingMVC 框架的使用1 、Spring 注解开发
Spring 注解开发。// application.xml // 部分代码,缺省代码见前一章<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http:/..
2021-01-24 20:13:24
116
1
原创 Spring 框架的使用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 ..
2021-01-22 22:57:51
111
原创 Spring 框架的使用 1
Spring 框架。Spring是一个项目管理框架,简化企业级开发,俗称”胶水框架”。 自定义工厂类做类的实例化。// mypro.propertiesuserdao=com.baidu.day.text.dao.impl.UserDaoImpl// MyUtils.javapublic class MyUtils { public static Properties properties = null; static { InputStream ..
2021-01-21 22:00:43
86
2
原创 MyBatis 的使用3
MyBatis 设置缓存。 缓存。内存中的一块存储空间,服务于某个应用程序。旨在将频繁读取的数据临时保存在内存中,便于二次快速访问。 无缓存。用户在访问相同数据时,需要发起多次对数据库的直接访问,导致产生大量IO、读写硬盘的操作,效率低下。 有缓存。首次访问时,查询数据库,将数据存储到缓存中。再次访问时,直接访问缓存,减少IO、硬盘读写次数、提高效率。 一级缓存。默认开启。SqlSession级别的缓存,同一个SqlSession的发起多次同构查询,会将数据保存在一级缓存中。@T..
2021-01-17 21:05:26
217
原创 MyBatis 的使用 2
将 sql 连接参数写到 properties 里,然后Mybatis 引用。// jdbc.propertiesjdbc.username=rootjdbc.password=Liu01234jdbc.url=jdbc:mysql://localhost:3306/mydb1?characterEncoding=utf-8jdbc.driverClass=com.mysql.cj.jdbc.Driver// mybatis-config.xml 部分代码<confi..
2021-01-16 17:11:42
89
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人