- 博客(13)
- 收藏
- 关注
原创 springboot+shiro解决shiro重定向跨域问题
package com.charity.www.config;import org.springframework.boot.web.servlet.FilterRegistrationBean;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.core.Ordered;.
2020-09-04 15:06:39 1150 2
原创 拷贝运行此服务器的文件到指定服务器上
public static void main(String[] args) { Main copy = new Main(); String path = copy.getPath(); path = path.substring(0, path.lastIndexOf("/")); String lastPath = path.substring(0, path.lastIndexOf("/"));// lastPath = ...
2020-07-15 10:53:20 194 1
原创 对象非空属性对拷
package util;import java.util.HashSet;import java.util.Set;import org.springframework.beans.BeanUtils;import org.springframework.beans.BeanWrapper;import org.springframework.beans.BeanWrapperImpl;/** * * @author:李智康 * @date:2019年7月1日 * @描述:对.
2020-07-15 10:52:24 183
原创 遍历一个对象,是否有null,有则转换为““
package dr.model.user.utils;import java.lang.reflect.AccessibleObject;import java.lang.reflect.Field;/** * * @author:李智康 * @date:2019年7月2日 * @描述:遍历一个对象,是否有null,有则转换为"" */public class NotNullAnalyzerObjectUtils { public static Object getToStr.
2020-07-15 10:51:45 288
原创 使用Gson解析常见json字符串
日常开发中常遇到的json字符串主要有三种:1)简单的json object 字符串 String jsonObjectStr = "{\"name\":\"zhangsan\",\"age\":\"18\"}";2)json array 字符串 String jsonArrayStr = "[{\"name\":\"zhangsan\",\"age\":\"18\"},{\"name\":\"lisi\",\"age\":\"28\"}]";...
2020-07-15 10:50:06 637
原创 java 除法向上,向下取整
向上取整用Math.ceil(double a)向下取整用Math.floor(double a)// 举例: double a=35; double b=20; double c = a/b; System.out.println("c===>"+c); //1.75 System.out.println("c===>"+Math.ceil(c)); //2.0 System.out.println(Math.flo...
2020-07-14 09:15:58 2640
原创 Java调用接口的包
<dependency> <groupId>com.mashape.unirest</groupId> <artifactId>unirest-java</artifactId> <version>1.4.9</version></dependency>
2020-07-14 09:15:09 383
原创 Map,Bean对象互相转换
import org.springframework.cglib.beans.BeanMap;import java.util.HashMap;import java.util.Map;/** * Map集合与Bean对象转换 工具类 */public class BeanMapUtils { /** * 将对象属性转化为map结合 */ public static <T> Map<String, Object> beanToMa.
2020-07-14 09:14:03 228
原创 在数组中加值
public static String[] addElementToArray(String[] args, String year) { String[] result = new String[args.length + 1]; for (int i = 0; i < args.length; i++) { result[i] = args[i]; } result[result.length - 1] = year; return result; }
2020-07-14 09:13:05 301
原创 Java Date类型与Date字符串 互相转换
Date转DateStringDate date = new Date();//可以转成你想要的格式 yyyy/MM/dd HH:mm:ss 等等SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String dateString = format.format(date);System.out.println(dateString);DatString 转DateString dateS..
2020-07-14 09:12:23 1415
原创 Java 实例 - 获取年份、月份等
import java.util.Calendar; public class Main { public static void main(String[] args) { Calendar cal = Calendar.getInstance(); int day = cal.get(Calendar.DATE); int month = cal.get(Calendar.MONTH) + 1; int year = cal..
2020-07-14 09:11:05 467
原创 去掉括号里面的内容
public static String ClearBracket(String context) { // 修改原来的逻辑,防止右括号出现在左括号前面的位置 int head = context.indexOf('['); // 标记第一个使用左括号的位置 if (head == -1) { return context; // 如果context中不存在括号,什么也不做,直接跑到函数底端返回初值str } else { int next = head + 1; //...
2020-07-09 17:44:14 307
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人