- 博客(10)
- 收藏
- 关注
原创 删除maven未下载成功的.lastUpdated文件
在cmd窗口运行cd %userprofile%\.m2\repositoryfor /r %i in (*.lastUpdated) do del %i
2018-12-11 14:48:35
1529
原创 解决synchronized(key)传入key值相等,却未成功上锁
此为学习笔记。实现:当传入方法的key值相同时,需要相隔一秒打印,不相同的,第一时间同时打印。问题:用synchronized(key)锁住打印的代码,key中有两条数据都是"1",预期效果应该是可以相隔一秒打印,但结果却是同时的。先上代码。public class ThreadTest3 extends Thread{ private String key; private...
2018-10-17 18:18:19
2150
原创 金额格式化
正确的方式:DecimalFormat mf = new DecimalFormat();mf.applyPattern("#,##0.00");System.out.println(mf.format(0.66));这样可以处理小于1的金额。 之前在网上看了很多金额的格式化方式,基本有两种。 1.全代码模式,自己写出分割逻辑,网上很多,这里就不说明了。 2.同样是使...
2018-07-13 09:26:09
2335
转载 CSRF攻击与防御
转载地址:http://www.phpddt.com/reprint/csrf.html CSRF概念:CSRF跨站点请求伪造(Cross—Site Request Forgery),跟XSS攻击一样,存在巨大的危害性,你可以这样来理解: 攻击者盗用了你的身份,以你的名义发送恶意请求,对服务器来说这个请求是完全合法的,但是却完成了攻击者所期望的一个操作,比如以你的名义发送邮...
2018-05-07 10:46:02
222
转载 springcloud身世与作用
Spring Cloud是一个集成了众多开源的框架,利用Spring Boot的开发便利性实现了服务治理、服务注册与发现、负载均衡、数据监控,REST API发布方式等,基本囊括了分布式框架所需要的所有功能。是一套易开放、易部署、易维护的分布式开发工具包。在详细的了解Spring Cloud中所使用的各个组件之前,我们先了解下微服务框架的前世今生。单体架构 在网站开发的前期,项目面临的流量相对较少...
2018-04-28 17:11:53
14861
1
原创 map调用toString()方法,返回字符串拼接有空格
测试代码:输出: [123, 456]输出后,拼接字段的首部,会有一个空格。Map toString()源码public String toString() { Iterator<Entry<K,V>> i = entrySet().iterator(); if (! i.hasNext()) return "{...
2018-04-26 17:37:41
5329
原创 springboot+springSecurity
错误信息: There is no PasswordEncoder mapped for the id "null"。错误原因: spring security 版本在5.0后就要加个PasswordEncoder了解决办法: 在安全配置类(即继承了WebSecurityConfigurerAdapter)里加上 @EnableWebSecurity//web安全p...
2018-04-25 19:43:40
190
原创 springboot+h2
错误信息:***************************APPLICATION FAILED TO START***************************Description:Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded dataso...
2018-04-24 10:26:42
730
原创 spring+thymeleaf
错误信息: 页面:Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Mon Apr 23 19:09:45 CST 2018There was an unexpected error (type=Internal Serv...
2018-04-23 19:18:49
10999
转载 Springboot+Thymeleaf
错误信息:***************************APPLICATION FAILED TO START***************************Description:The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use...
2018-04-23 19:07:55
338
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人