java
文章平均质量分 81
旧风年间
这个作者很懒,什么都没留下…
展开
-
原子操作类AtomicInteger学习
为什么需要AtomicInteger原子操作类? 很多时候我们都用到 num++,若没有加synchronized关键字则是线程不安全的,num++解析为num=num+1,明显,这个操作不具备原子性,多线程时必然会出现问题,测试下: public class AtomicIntegerTest { public static int num = 0; public st...原创 2018-11-06 17:23:13 · 712 阅读 · 0 评论 -
前台向后台传json数据
做记录 var personData = { name : $('#name').val(), phone : $('#phone').val(), type : $('#type').val(), }; //传参时 data:{ personJson:JSON.stringify(masterData) } 后台接收 @RequestMapp...原创 2018-11-09 16:07:05 · 504 阅读 · 0 评论 -
数据绑定 注解
@ModelAttribute 注解添加一个或多个属性(类对象)到 model 上。例如 1 2 @RequestMapping(value = "/create", method = RequestMethod.POST) public String postUser(@ModelAttribute User user) ...原创 2018-11-15 16:06:09 · 166 阅读 · 0 评论 -
java根据汉字获取全拼和首字母
import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; import net.sourceforge.pinyin...转载 2019-02-12 16:32:33 · 451 阅读 · 0 评论