- 博客(54)
- 资源 (8)
- 问答 (3)
- 收藏
- 关注
原创 yml文件的list,map
country: countryConfig: aue: - lang: zh isDefault: true - lang: en isDefault: false hk: - lang: zh isDefault: true上述所对应的java类为:@Component@Config...
2019-09-06 14:56:20
2684
原创 lombok找不到log符号
开发过程中,使用了lombok的Slf4j进行打印日志信息可能会出现一种情况,新建的类在使用log进行印时出现问题:使用的logback作日志的实现在代码中也引入了注解@Slf4j,但问题还是出现了。原因是在idea的设置中Annotation Processors,需要启用此设置如果新建的项目上默认是没有勾上的,可以在File->other settings->defa...
2019-03-13 22:39:11
13483
5
原创 定位springboot项目打包后,没有主清单属性
首先是一个父模块有3个子模块provider模块依赖api和service模块。provider是需要打成jar包,以便在服务器端通过java -jar的方式进行启动的所以provider的pom.xml中一定要有如下的插件的<build> <plugins> <plugin> <groupId>org.springfram...
2019-02-20 13:21:36
1211
1
原创 git subtree使用基本操作及--squash
#查看关联的远程仓库的详细信息git remote -v一、初始化subtree项目步骤 1、语法:git remote add -f <子仓库名> <子仓库地址> 解释:其中-f意思是在添加远程仓库之后, 立即执行fetch.例如:git remote add -f proto git@gitee.com:zkh201/zkh-proto.git...
2019-02-15 13:19:20
3021
原创 maven生成源码jar包
存在两个独立的服务,其中的一个服务引用了另一个服务,如何看其中的源代码添加maven的插件即可<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> ...
2019-02-14 13:40:53
566
原创 抽取List的属性值
public static <T, R> List<R> extractField(List<T> list, Function<T, R> func) { if (CollectionUtils.isEmpty(list)) { Collections.emptyList(); } ...
2018-11-16 16:30:25
540
原创 反射设置createTime和updateTime
public static <T> void initTimeField(T t) { List<String> strings = Arrays.asList("setCreateTime", "setUpdateTime"); Date date = DateTime.now().toDate(); strings.s...
2018-11-16 16:28:19
805
原创 前端传递的是时间戳,在后端接收参数时转换成UTC时间
@InitBinder protected void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Date.class, new MyDateEditor()); } private class MyDateEditor extends PropertyEditorSuppo...
2018-09-13 20:08:36
17004
原创 postman测试时传递对象中是list参数
{ "xxx":[ { "xxx":{ "xxx":"23", "xxx":"2322", "xxx":"2323" } }, {
2018-09-04 19:15:08
20493
原创 下载文件时:报错Invalid mime type "application/octet-stream;
出现的问题: control层调用下载接口,因一般需要返回一个经过包装的Response返回给前端,目前看来是调用下载接口时是不需要返回值的,且有返回值的话 会报上面的错误 目前问题解决的方式: 将返回值去掉...
2018-09-04 14:08:26
6466
原创 springboot配置返回时间戳
springboot2.0后,spring会将时间自动给转成UTC字符串了 springboot1.x版本的将date字段返回的是时间戳 配置返回时间戳spring jackson: serialization: write-dates-as-timestamps: true全局配置返回字符串spring: jackson: da...
2018-08-31 11:14:47
24930
13
原创 swagger的一个bug: AbstractSerializableParameter
在使用@ApiModelProperty注解在字段上时,如果字段的类型为Long或是int类型,那么程序启动后,访问swagger-ui.html的页面,程序会报错java.lang.NumberFormatException: For input string: ""在swagger的官方文档中介绍是一个bug;可以忽略这个错误,如果看着不爽,可以调整日志的级别# appli...
2018-08-20 18:33:02
6525
1
原创 Error:java: 无法访问javax.annotation.CheckReturnValue 找不到javax.annotation.CheckReturnValue的类文件
需要研究一下,这个错误为什么: <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId> <version>2.0.1</version><
2018-08-10 16:23:44
3632
原创 idea新建proto文件时关联到XHTML文件type上
将proto文件关联到XHTML时,新建的proto文件中写的protobuf语法都给报错,如: 修改方法: File Type中选择XHTML找到其关联的proto文件将其移除 然后在protobuf中将其添加关联proto类型的文件 ...
2018-08-09 19:39:23
697
原创 使用consul遇到的第一个问题
项目中使用到了consul;自己先新建个项目了解一下consul; 情况如下: 新建个springboot项目,引入consul依赖和lombok依赖<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId&g...
2018-08-07 19:58:51
4722
1
原创 使用simple xml解析xml文档
@Root(strict = “false”) @Element(required = “false”) 两个都为false时,才会忽略xml文件中不存在,但在class中存在的属性Element的doc: http://simple.sourceforge.net/download/stream/doc/javadoc/org/simpleframework/xml/Element...
2018-08-06 13:06:12
560
原创 排序
快速排序package com.zkh.sort;/** * 快速排序算法: * 找一个基数 * 使其左边的值都不大于这个基数 * 右边的值都都不小于这个基数 */public class QuitSort { //快速排序 public static void main(String[] args) { int array[] =...
2018-08-03 14:31:58
153
原创 项目部署到tomcat后,启动时配置文件不在class目录下
问题是 如图片所示:问题出现在只有com文件夹中的源码文件,而没有下面的那些配置文件,解决方法: 将resources添加在build path中
2018-07-20 20:04:27
1660
原创 类加载器的加载顺序
package com.zkh;//测试对静态代码块和public class ClassLoaderTest { { System.out.println("主调类的非静态代码块"); } static { System.out.println("主调类的静态代码块"); } public ClassLoader...
2018-07-17 17:00:57
640
原创 设置io类中的基地址user.dir
根据File JDK文档说明,java.io包中所有类,这个基地址由user.dir这个属性制定,也叫当前目录。用下面这段代码可以获取到路径是什么System.out.println(System.getProperty("user.dir"));其实获取的就是 File file = new File(“/com/xxx/xxx.class”)一直找不到文件, Working d...
2018-06-18 15:31:27
1165
1
转载 ThreadPool源码记录
原文地址: https://www.colabug.com/2114619.htmlThreadPoolExecutor执行execute方法: 这个方法执行任务时:判断当前线程池线程数量是否小于核心线程池大小,是则创建线程并启动,否则到第2步判断任务队列是否已满,未满则将任务加入阻塞队列,已满则到第3步判断当前线程池线程数量是否小于最大线程池大小,是则创建线...
2018-06-13 11:30:57
355
原创 redis集群搭建过程及其操作
1、安装ruby、rubygem 2、使用gem安装redis接口(已经存在redis-4.0.1.gem)gem install redis-4.0.1.gem3、创建多个文件夹(因为已经存在一个redis,故可新建5个文件夹,将redis.conf分别拷贝到5个文件夹中,修改port、dbfilename、logfile、cluster-config-file、pidfile ),设...
2018-06-06 17:52:17
229
原创 redis集群搭建--redis启动以后台方式启动
前提:搭建好redis集群后,使用start_all.sh启动所有节点,但是在启动第一个节点后,其他的节点并没有启动,使用ps -ef | grep redis并没有显示其它节点,只有当停掉该节点,下一个节点才会启动Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程启用守护进程后,Redis会把pid写到一个pidfile中,在/var/run/red...
2018-06-06 09:56:09
1261
原创 web项目页面展示乱码????
测试servlet程序: idea部署tomcat服务器跑servlet程序,在浏览器中显示的时候出现乱码问题,问题出现在代码上 此乱码对应的程序为protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOExcept...
2018-06-01 17:18:34
2860
3
原创 记一次springcloud的feign调用报错exception is feign.RetryableException: Read timed out executing POST http://
问题出现在:eureka.instance.non-secure-port=80这个配置上,解决这个问题之前不了解这个配置的作用,自动忽略了 情况描述: 使用@feignclient调用服务提供者,但是每次都报标题所记错误,搜索的类似错误,都是要修改超时时间,但是我把@feignclient中的value修改为开发环境的应用名称是正常的(开发环境用的类似于${server.port},...
2018-05-31 17:01:00
29367
原创 解决springboot2.0+springcloud版本Finchley.RC1访问hystrix.steam不通
参考:http://www.cnblogs.com/wangdaijun/p/8891220.html 参考:https://www.cnblogs.com/java-zhao/p/5813439.html由此可知,添加servlet: package com.xxx.firstboot.hystrix.dashboard;import org.springframewor...
2018-05-24 19:25:54
1670
原创 proxyee_down启动时未连上百度云网盘
查看日志,disabledProxy errorjava.net.SocketException: Can't connect to SOCKS proxy:Connection refused (Connection refused) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:428) at java....
2018-05-23 14:59:51
6101
原创 spring-cloud-config配置中心报错:java.lang.IllegalStateException: duplicate key: spring
java.lang.IllegalStateException: duplicate key: spring at org.yaml.snakeyaml.constructor.SafeConstructor.processDuplicateKeys(SafeConstructor.java:99) ~[snakeyaml-1.19.jar:na] at org.yaml.snak...
2018-05-22 14:46:51
7665
原创 学习springcloud目前存在的问题
由于与杨恩雄老师的所操作的环境不一致,目前在视频学习中遇到了两个问题暂未解决: 1、在学习hystrix组件时,在客户端处添加了actuator的依赖,但是在进行访问ip:port/hystrix.stream报错404 2、在学习zuul组件时,我的springboot是2.0.1的版本,故在配置security.basic.enable=false时是出错的the secu...
2018-05-21 09:33:22
1831
原创 maven命令mvn install安装jar到本地仓库
在jar包所在目录执行命令: mvn install:install-file -Dfile=xxx-0.1.0.jar -DgroupId=local.lib -DartifactId=xxx Dversion=0.1.0 -Dpackaging=jar -DgeneratePom=true Dfile:jar包名称 DgroupId、DartifactId、Dversion:仓库...
2018-05-17 10:06:08
2621
原创 源码反编译工具procyon-decompile使用
-o:输出 第一个-jar是指定procyon的jar包 第二个-jar是指定要反编译的jar文件或class文件如果是class文件(需将路径指定到class文件): 将procyon-decompile拷贝到class文件的上一级目录 java -jar procyon-decompiler.jar ./某路径/* -o ./某路径/* 如果是jar文件: ...
2018-05-16 17:43:09
3594
原创 正则表达式匹配反编译后的源码中的注释
反编译后的源码中的注释包含2中(我遇见的): 1、/* */ 2、/* 50(就是一行号) */ 在notepad++中选择文件查找选择指定目录,查找模式选择正则,使用的正则表达式匹配: 1、/*[\s]+*/ 2、/*\s[0-9]+\s*/ 删除完成...
2018-05-16 16:28:03
625
原创 @Qualifier与@Resource与@Autowired的区别
@Autowired是根据类型进行自动装配的。如果当Spring上下文中存在不止一个UserDao类型的bean时,就会抛出BeanCreationException异常;如果Spring上下文中不存在UserDao类型的bean,也会抛出BeanCreationException异常。我们可以使用@Qualifier配合@Autowired来解决这些问题。如下:①可能存在多个UserDao实...
2018-05-16 09:17:29
1007
原创 使用ConfigurationManager报错Cannot access org.apache.commons.configuration.event.EventSource
使用idea对ribbon进行demo测试(eclipse使用正常): 在使用ribbon的原生api进行负载均衡,添加了依赖&lt;dependency&gt; &lt;groupId&gt;com.netflix.ribbon&lt;/groupId&gt; &lt;artifactId&gt;ribbon-core&lt;/artifac
2018-05-15 09:08:31
3841
3
原创 Field myFeignClient in com.zkh.controller.FeignController required a bean of type 'com.zkh.feign.MyF
Description:Field myFeignClient in com.zkh.controller.FeignController required a bean of type 'com.zkh.feign.MyFeignClient' that could not be found.Action:Consider defining a bean of type 'com....
2018-05-03 15:25:44
5323
3
原创 Exception in thread "main" feign.FeignException:
Exception in thread "main" feign.FeignException: status 404 reading FeignClient#getCal(int,int); content:{"timestamp":"2018-04-28T06:44:18.551+0000","status":404,"error":"Not Found","message
2018-04-28 17:34:36
667
原创 idea新建的spring-cloud-eureka-client启动后自动停止
pom.xml文件中添加<!-- web应用 --><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId></dependency>..
2018-04-27 09:46:15
2239
1
eclipse-jee-indigo-SR2-win32-3.7和maven插件下载
2017-04-14
mysql-5.6.24_64位 and mysql-5.7.17_64位安装包及安装方法
2017-04-09
TA创建的收藏夹 TA关注的收藏夹
TA关注的人