什么是Hystrix,Hystrix如何使用
摘要:什么是Hystrix,Hystrix如何使用 容错框架Hystrix,SpringCloud将Hystrix整合到Netflix项目中了。它主要用来添加一个延迟的阀值和容错逻辑。来帮助我们控制分布式系统之间的组件交互。 那么什么是延迟阀值呢:就拿下图中的销售模块举例,在销售模块调用会员模块的时候,会
阅读全文
posted @
2019-01-01 17:54
沛昕的博客
阅读(1039)
推荐(0)
Spring 添加自定义拦截器
摘要:import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.Web...
阅读全文
posted @
2018-11-14 17:14
沛昕的博客
阅读(556)
推荐(0)
JavaBean对象与Map对象互相转化
摘要:import java.util.Map; import org.apache.commons.beanutils.BeanMap; import org.apache.commons.beanutils.BeanUtils; /*** * JavaBean对象与Map对象互相转化 */ public class ConverMapToObject { public stati...
阅读全文
posted @
2018-11-12 16:27
沛昕的博客
阅读(513)
推荐(0)
Java 分页工具类
摘要:/*** * 分页工具类 */ public class Page { private int pageSize = 5;// 页显示条数 private int currentPage;// 当前页码 private Long totalSize;// 总记录条数 private int totalPage;// 总页数 private i...
阅读全文
posted @
2018-10-12 16:55
沛昕的博客
阅读(255)
推荐(0)
使用 SimpleDateFormat 获取上个月的日期
摘要:SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM"); Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); // 设置为当前时间 calendar.set(Calendar.MONTH, cale...
阅读全文
posted @
2018-09-30 10:08
沛昕的博客
阅读(756)
推荐(0)
使用 HttpClient 调用第三方接口
摘要:private static RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).setConnectionRequestTimeout(60000).build();try { CloseableHttpClient httpCli...
阅读全文
posted @
2018-09-29 16:30
沛昕的博客
阅读(609)
推荐(0)
Servlet 的生命周期及工作原理
摘要:Servlet 生命周期 过程:加载 --> 实例化 --> 服务 --> 销毁 init():在Servlet生命周期中,init()方法只执行一次,无论有多少客户端访问,都不会重复执行。它是在服务器装入Servlet时执行的,负载初始化Servlet对象。 service():当Servlet容
阅读全文
posted @
2018-09-27 11:05
沛昕的博客
阅读(443)
推荐(0)