
java
ISaiSai
这个作者很懒,什么都没留下…
展开
-
java word 转html 的两种方法
java word html 转化原创 2022-06-24 16:01:09 · 2270 阅读 · 1 评论 -
JavaMail requires an InputStreamSource that creates a fresh stream for every call.
JavaMail requires an InputStreamSource that creates a fresh stream for every call.原创 2022-06-24 15:24:41 · 997 阅读 · 0 评论 -
javaMailSender 发送邮件设置昵称
昵称 邮件 java原创 2022-06-24 14:51:38 · 953 阅读 · 0 评论 -
String split 转 arrayList,java.lang.UnsupportedOperationException
split原创 2022-06-24 13:45:06 · 945 阅读 · 0 评论 -
InputStream转InputStreamSource
inputStream 转 inputStreamSource原创 2022-06-23 16:12:08 · 2959 阅读 · 0 评论 -
修改IDEA格式化单行注释 后增加空格
单行注释 增加空格原创 2022-06-08 10:07:41 · 3866 阅读 · 1 评论 -
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
SQL 当使用in 拼接 的时候当in中没有数据的时候,会包错如上如 AND (item_id IN ())需要在上游做空数组判断原创 2022-05-23 15:31:43 · 623 阅读 · 0 评论 -
idea git 快捷键
提交commit:ctrl+kpush:ctrl+shift+k原创 2022-05-22 10:08:25 · 1087 阅读 · 0 评论 -
org.springframework.beans.factory.annotation.value 防止不存在报错Could not resolve placeholder
@Value("${base.name?:'hehe'}")String name;当在application.yml 中没有配置base.name的时候,系统会报错:Could not resolve placeholder常规解决办法是补充一个配置也可以在@Value 值中通过三元运算符设置一个默认值...原创 2022-05-21 17:03:37 · 1349 阅读 · 0 评论 -
SpringBoot Cloud 配置优先级问题
第一优先级 JVM配置-Dbase.name=456第二优先级application.yml 或者application.properties第三优先级bootstrap.yml 后者bootstrap.properties原创 2022-05-21 16:08:34 · 418 阅读 · 0 评论 -
Springboot org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean wit
SpringBootTest 测试用例中,当引入@Autowird 一个包含 @Test 的类的时候,会报告找不到,autowird 的类不能有@test 测试否则报告UnsatisfiedDependencyException,无法加载该类原创 2022-05-17 15:34:54 · 697 阅读 · 0 评论 -
ScopeNotActiveException 异常
@Scope(value = WebApplicationContext.SCOPE_REQUEST)修改为@Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS)问题解决Unsatisfied dependency expressed through field 'subClass'; nested exception is org.springframework.b原创 2022-05-17 12:45:33 · 1404 阅读 · 0 评论 -
mvn test 指定suit
方法1:使用命令行 mvn -DrunSuite=**/Junit5Suit test 2.配置POM <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <includes>.原创 2022-05-16 10:53:41 · 525 阅读 · 0 评论 -
MockMultipartFile mock文件上传
ClassPathResource resource = new ClassPathResource("XXX.js"); MockMultipartFile mfile = new MockMultipartFile("file", "XXX.js", "png", resource.getInputStream()); MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.multipart("/XX..原创 2022-05-13 17:13:49 · 8490 阅读 · 0 评论 -
JAVA 中 JSON文件的读取
package com.example.demo.jsonParse;import com.alibaba.fastjson.JSON;import org.junit.jupiter.api.Test;import org.springframework.core.io.ClassPathResource;import org.springframework.util.FileCopyUtils;import java.io.IOException;import java.nio.char原创 2022-05-13 11:32:49 · 1885 阅读 · 0 评论 -
Junit4 Suite.SuiteClasses升级 junit5
在junit5 中已经没有Suite.SuiteClasses需要替换为org.junit.platform.suitejuni4代码@RunWith(Suite.class)@Suite.SuiteClasses({Junit4_1Test.class,Junit4Test.class})public class OneTest {}junit5代码@IncludeTags("production")@Suite@SelectPackages({"com.example.demo.原创 2022-05-12 18:27:44 · 520 阅读 · 0 评论 -
SpringBoot使用cobertura-maven-plugin生成代码覆盖率报表
pom配置 <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin>原创 2022-05-12 16:17:59 · 291 阅读 · 0 评论 -
当一个方法下线,@Deprecated ,需要指向另外一个方法时候
当一个方法下线,@Deprecated ,需要指向另外一个方法时候参见Date 的getYear * @see java.util.Calendar * @deprecated As of JDK version 1.1, * replaced by {@code Calendar.get(Calendar.YEAR) - 1900}.原创 2022-04-29 15:57:07 · 810 阅读 · 0 评论 -
SpringBoot max-threads设置方式(2.3 版本以后)
目前网上文章写设置SpringBoot tomcat 的max_threads 的方法为:server.tomcat.max-threads=250但是在springboot 2.3 以后已经修改为 server.tomcat.threads.max=400老的设置会不生效验证方法@Configurationpublic class EmbedTomcatConfig { @Bean WebServerFactoryCustomizer<ConfigurableServle原创 2022-04-20 16:52:05 · 4506 阅读 · 0 评论 -
Dubbo默认超时时间
默认超时时间为1秒(1000毫秒)消费者单个服务的超时时间限制@DubboReference(version = "1.0.0" ,timeout = 2000)全局设置dubbo: consumer: timeout: 2000原创 2022-04-20 10:33:10 · 3695 阅读 · 0 评论 -
rampUp时间 jmeter
官方解释首先说明结论是:ramp up的值应该是启动全部线程所需的时间。就像官方的例子:我需要启动10个线程,并且10s启动一个线程,所以我的ramp up的值就是10*10=100s。我需要启动30个线程,并且设置的ramp up的值是120s,那我就是120/30=4s每4秒启动一个线程。参考文档:https://www.jianshu.com/p/018bc03d26c3...原创 2022-04-15 10:05:21 · 2335 阅读 · 0 评论 -
deprecated注释 原因
@Deprecated 标记下线接口或者属性的时候,希望能够说明下线原因及新的方法地址可以使用注释 /** * @deprecated 我为什么要下线这个字段或者方法,替代的字段或者方法是 {@link com.example.demo.SimpleCache.CacheObj#longData} */ @Deprecated private BigDecimal decimal;使用方看到的效果...原创 2022-04-14 11:48:27 · 400 阅读 · 0 评论 -
基于ConcurrentHashMap 最简单无超时时间的本地缓存类
基于:ConcurrentHashMap无缓存过期时间仅仅有缓存最大大小package com.example.demo.SimpleCache;import java.util.Map;import java.util.concurrent.ConcurrentHashMap;public class SimpleSimpleCacheUtils { private static final Integer CACHE_MAX_NUMBER = 100; private s原创 2022-04-12 19:43:24 · 708 阅读 · 0 评论 -
springBoot Cache 设置缓存启用开关
背景:希望一个统一的开关开放和关闭缓存结论:运行时通过nacos配置目前发现无法设置,只能通过配置开关后,重启服务器实现application.yml配置openCache: false@Configurationpublic class CacheConfig { @Value("${openCache}") Boolean openCache; @Bean("caffeineCacheManager") public CacheManager cacheM原创 2022-04-12 18:58:28 · 2231 阅读 · 0 评论 -
Spring Cacheable 数组KEY解决办法
问题:当使用Cacheable 的入参是一个数组的时候,发现KEY生成逻辑困难@Cacheable(value = "sampleCache" ) public String innerCache(String[] ids)方案0: 不写Key,正常缓存,没问题,但觉得和其它代码不统一,尝试写一个方案1:,key=“T(java.util.Arrays).asList(#ids).hashCode()” 无效方案2:通过自定义keyGenerator 实现,能够正常 @Cachea原创 2022-04-12 18:37:12 · 2154 阅读 · 0 评论 -
yml 与 yaml的区别
没有区别,一样的原创 2022-04-12 13:41:37 · 17004 阅读 · 14 评论 -
caffeine缓存失效时间设置
两种设置方法Yml文件spring: cache: type: caffeine caffeine: spec: maximumSize=500,expireAfterWrite=5sconfig 文件package com.example.demo;import com.github.benmanes.caffeine.cache.Caffeine;import org.springframework.cache.CacheManager;import o原创 2022-04-11 20:21:37 · 4759 阅读 · 0 评论 -
org.springframework.cache.caffeine.CaffeineCacheManager 找不到解决
参考文档:http://www.manongjc.com/detail/24-fehzvghpopnfaiz.html需要引入 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> </dependency>问题解决...原创 2022-04-11 20:14:01 · 1186 阅读 · 0 评论 -
Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullPointerEx
spring-boot-starter-parent:2.6.6 与 swagger2.9.2冲突spring-boot 降级为: 2.5.4 后正常<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.6.6</version>原创 2022-04-02 16:31:33 · 158 阅读 · 0 评论 -
org.apache.commons.lang.StringUtils isBlank 与 isEmpty 的区别
System.out.println(StringUtils.isEmpty(" ")); // 返回false System.out.println(StringUtils.isBlank(" ")); // 返回true空字符串的时候 isEmpty 返回false , isBlank 返回true万事开头难...原创 2019-04-25 10:26:07 · 462 阅读 · 0 评论 -
MAC JAVA 1.8 与 9 版本切换
vi .bash_profile 内容如下export JAVA_HOME_8=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Homeexport JAVA_HOME=$JAVA_HOME_8alias jdk8='export JAVA_HOME=$JAVA_HOME_8'alias jdk9='export JAV转载 2017-10-31 16:33:30 · 4069 阅读 · 0 评论 -
mvn 包冲突处理
mvn dependency:tree > tree.txt转载 2016-12-14 20:33:50 · 369 阅读 · 0 评论 -
JAVA 图片截取
通过 BufferedImage 和 ImageReader 实现图片裁剪功能 // 裁剪图片 private static void cutImage() throws IOException { String type = "jpg"; // 裁剪的位置 int x = 100; int y = 100;原创 2016-09-16 13:56:15 · 2576 阅读 · 0 评论 -
eclipse 查询结果 在新窗口中打开
eclipse 点击查询结果,默认会覆盖上一个查询结果的窗口,无法两者都显示修改方法 将如下配置前面的钩去掉: Preferences > General > Search > Reuse editors to show matches 参考文章: http://stackoverflow.com/questions/13370040/eclipse-is-replacing-原创 2016-06-13 08:28:40 · 5631 阅读 · 0 评论 -
mac eclipse 无法debug问题解决
mac eclipse debug 报错Cannot connect to VMSocket closed解决办法,指定host,问题解决 127.0.0.1 localhost原创 2016-05-26 21:00:52 · 2407 阅读 · 1 评论 -
eclipse 格式化快捷键 ctrl+shift+f
eclipse 格式化快捷键 ctrl+shift+f继续学习java转载 2015-04-14 08:53:31 · 798 阅读 · 0 评论 -
java split 入门
工作了8年,写了8年代码,c转载 2014-09-12 15:16:24 · 475 阅读 · 0 评论 -
velocity 语法总结
1.单行注释 ##2.多行z原创 2014-09-10 10:57:33 · 515 阅读 · 0 评论