各种DEMO
东风不来
东风不来,水波不兴
展开
-
String.format
对字符串补零,在字符串右侧String.format("%-6s", ‘4400’).replaceAll(" ", "0");原创 2021-10-25 09:54:32 · 309 阅读 · 0 评论 -
日期的一下操作
public static void main(String[] args) throws InterruptedException, ParseException { String str = "2021-10"; // 2021-06-03 10:23:32 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH.原创 2021-10-18 16:46:19 · 85 阅读 · 0 评论 -
Null key for a Map not allowed in JSON (use a converting NullKeySerializer?)
springboot默认使用的json解析组件是jackson;然后将map转json时,如果其中map的key中含有null,会报标题所示的错误;这里将jackjson改为了fastjson,fastjson支持key为null;https://blog.csdn.net/u010953706/article/details/107907754...原创 2021-08-11 11:51:09 · 303 阅读 · 0 评论 -
springboot读取外部配置
打包的时候排除配置文件:https://blog.csdn.net/chen_blog/article/details/80017053 <build> <resources> <resource> <filtering>true</filtering> <directory>src/main/resources</d原创 2021-08-06 15:42:17 · 73 阅读 · 0 评论 -
HttpMessageConverter的作用和fastjson的使用
在SpringMVC / SpringBoot中@RequestBody这类注解默认使用的是jackson来解析json而fastjson更加优秀使用fastjson对bean进行处理:依赖:<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}&l原创 2020-08-10 11:17:28 · 1394 阅读 · 0 评论 -
DEMO:正则使用
/** * 根据正则表达式,从指定字符串获取字串 */ public static void findSubString() { String str = "SUBST_ID = 10307 OR SUBST_ID = 200000000 "; String regex = "=\\s*'?(\\w+)"; Pattern p = Pattern.compile(regex...原创 2019-11-04 11:07:38 · 81 阅读 · 0 评论