随笔分类 - java
摘要:个人理解 通过mockito给程序设定一个预期值,然后通过mockito仿真执行程序,看执行逻辑输出是否符合预期的结果。主要用于检测逻辑是否正确。由于不是真的执行,因此会隔离真实环境。无法测试底层调用或者sql是否存在问题。 mockito 资源 官网: http://mockito.org API
阅读全文
摘要:Intellij IDEA2020.x社区版运行报command line is too long. shorten command line for xxx 错误解决办法 解决方法 在项目/.idea/workspace.xml文件中添加一行代码如下: <component name="Prope
阅读全文
摘要:http请求工具 依赖 <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> <!--使用最多--> <dependency> <groupId>org.apache.httpcomponen
阅读全文
摘要:Maven中央仓库地址 http://www.sonatype.org/nexus/ 私服nexus工具使用 http://mvnrepository.com/ (推荐) http://repo1.maven.org/maven2 http://maven.aliyun.com/nexus/cont
阅读全文
摘要:自定义token,继承 AbstractAuthenticationToken import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.sec
阅读全文
摘要:spring-boot quartz定时任务 基本功能 串并行控制 定时任务(CRUD) 定时任务启停 立即执行定时任务 相关依赖 其他缺的依赖自行引入 <!-- Quartz 这个才是最主要的 --> <dependency> <groupId>org.quartz-scheduler</grou
阅读全文
摘要:本文关于新的peer节点加入网络的相关操作是基于java版本的sdk进行的。 假设你原本是基于Template创建的节点 修改crypto-config.yaml配置 OrdererOrgs: # orderer的配置在这里就省略了 - ... PeerOrgs: - Name: Org1 Doma
阅读全文
摘要:一般生产环境不会直接这么用,但是springboot提供的这个功能还是很有用的,比如说我们自己做并发测试,模拟定时任务。 其他依赖 <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <versi
阅读全文
摘要:前言 在jdk中Executors类中提供了诸如newFixedThreadPool()、newSingleThreadExecutor()、newCachedThreadPool()等创建线程的方法,但是都具有一定的局限性,不灵活,且内部还是通过ThreadPoolExecutor来创建的,使用T
阅读全文
摘要:目的大概是这样子的,就是在idea上创建号项目,然后在git创建号仓库,直接将本地的项目初始化push到仓库中去。 在GitHub上创建仓库 输入你的仓库名,最好与项目名相同。 创建本地仓库 VCS --> Import into Version Control --> Create Git Rep
阅读全文
摘要:Java中的Log4j简易配置 依赖(Maven) <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <g
阅读全文
摘要:Java web项目集成Swagger报AbstractSerializableParameter类的异常问题 异常信息大致如下: [nio-1111-exec-4] i.s.m.p.AbstractSerializableParameter : Illegal DefaultValue null
阅读全文
摘要:SpringBoot之RabbitMQ实现两种延时队列 参考:https://blog.csdn.net/qq_37892957/article/details/89296157 参考:https://blog.csdn.net/u014308482/article/details/53036770
阅读全文
摘要:# Java8两个集合(List)取交集、并集、差集、去重并集  ```java import java.util.
阅读全文
摘要:异常信息 Type definition error: [simple type, class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactoryEnhancedResultObjectProxyImpl];nested
阅读全文
摘要:相较与古老的ssm项目,springboot项目的切面编程几乎不用配置。开箱即用。 依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId>
阅读全文
摘要:自定义注解 import java.lang.annotation.*; /** * @author wzm */ //注解会在class中存在,运行时可通过反射获取 @Retention(RetentionPolicy.RUNTIME) //目标是方法 @Target({ElementType.M
阅读全文
摘要:springboot项目下的一些统一操作。 idea需要实现安装lombok插件 依赖: 依赖少了的,漏了的自己引。 <!--切面--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-
阅读全文
摘要:用途 1) 把对象的字节序列永久地保存到硬盘上,通常存放在一个文件中。 2) 在网络上传送对象的字节序列。 操作类 java.io.ObjectOutputStream 代表对象输出流,它的writeObject(Object obj)方法可对参数指定的obj对象进行序列化,把得到的字节序列写到一个
阅读全文