201810-10 SpringBoot @Transactional 中捕获异常并回滚解决方法 NEW 业务需求:需要捕获到@Transactional中的异常,并不影响事物回滚public void test() { try { updata(); &... Read More >
201808-30 Springboot+Redis 配置和使用 NEW pom.xml 引入redis 开启缓存<!-- cache --> <dependency> <groupId>org.springframework.boot<... Read More >
201808-30 Redis客户端可视化工具 NEW 管理redis的可视化客户端目前较流行的有三个:Redis Client ; Redis Desktop Manager ; Redis Studio. 这里目前给大家介绍Redis Client 的下载安装及基本使用。 RedisClient是Redis客户端的GUI工具,使用Java swt和jedis编写,可以方便开发者浏览Redis数据库。该软件支持简体中文,非常适合国内用户使用,不需要汉化就可以直接使用。RedisCl... Read More >
201808-29 SpringBoot Kafka 整合使用 前提假设你了解过 SpringBoot 和 Kafka。1、SpringBoot如果对 SpringBoot 不了解的话,建议去看看 DD 大佬 和 纯洁的微笑 的系列博客。2、KafkaKafka 的话可以看看我前两天写的博客 : Kafka 安装及快速入门 学习的话自己开台虚拟机自己手动搭建环境吧,有条件的买服务器。注意:一定要亲自自己安装实践,接下来我们将这两个进行整合。创建项目项目整体架构:使用 IDEA 创... Read More >
201806-21 springboot如何设置默认的首页呢?? Spring boot的设计原则就是 约定优于配置。并且内嵌了Servlet容器。一般来说,这个配置传统上是配置在web.xml上的。所以有三种解决方案:1.使用Spring boot的传统部署,就是将Spring Boot部署到外面的Servlet容器中,自然就可以自行配置web.xml了(还可以用Java代码的方式配置)。具体方法参考Spring Boot文档。2.@leftstick的方法,用java代码定义加一个Controller的映射,优点是要映射的路径和要转发的... Read More >
201806-15 spring在controller中,在执行其他方法之前,都先调用@ModelAttribute修饰的方法 @ModelAttribute所有的controller都继承一个基础的controller,在基础controller中用@ModelAttribute修饰一个方法,就可以做到在执行所有的方法之前,先执行这个方法例如:public class BaseController { @ModelAttribute ... Read More >
201806-11 Unicode编码和中文互转(JAVA实现) //中文转Unicode public static String gbEncoding(final String gbString) { //gbString = "测试" ... Read More >
201806-05 Calendar 操作时间和日期的主要类 /* * Calendar 类是时间和日期操作的主要类 */ Calendar calendar = Calendar.getInstance(); //获得当前年份 System.out.println(calendar.get(Calendar.YEAR)); //输出结果 2018 Calendar.MONTH; ... Read More >
201806-05 TimeZone 表示时区 //TimeZone 表示时区,它是一个抽象类,有静态方法用于获取其实例.获取当前的默认时区,代码为 TimeZone tz = TimeZone.getDefault(); System.out.println(tz.getID()); /* * 获取默认时区,并输出其ID,本人计算机中输出 Asia/Shanghai &nbs... Read More >
201806-05 string 类常用方法 操作字符串 public boolean isEmpty() //判断字符串是否为空 public int length() //获取字符串长度 public string substring(int beginIndex)//取子字符串 public string substring(in... Read More >
201806-04 SpringBoot实现邮件发送:简单邮件、附件邮件、嵌入资源邮件、模板邮件 相信使用过Spring的众多开发者都知道Spring提供了非常好用的JavaMailSender接口实现邮件发送。在Spring Boot的Starter模块中也为此提供了自动化配置。下面通过实例看看如何在Spring Boot中使用JavaMailSender发送邮件。快速入门在Spring Boot的工程中的pom.xml中引入spring-boot-starter-mail依赖:如其他自动化配置模块一样,在完成了依赖引入之后,只需要在application.proper... Read More >
201805-31 阿里P7/P8学习路线图——技术封神之路 一、基础篇JVMJVM内存结构堆、栈、方法区、直接内存、堆和栈区别Java内存模型内存可见性、重排序、顺序一致性、volatile、锁、final垃圾回收内存分配策略、垃圾收集器(G1)、GC算法、GC参数、对象存活的判定 JVM参数及调优Java对象模型oop-klass、对象头HotSpot即时编译器、编译优化类加载机制classLoader、类加载过程、双亲委派(破坏双亲委派)、模块化(jboss modules、osgi、jigsaw)虚拟机性能监控与故障处... Read More >
201805-24 移动端总结和手机兼容问题 H5页面窗口自动调整到设备宽度,并禁止用户缩放页面<meta name="viewport" con\="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />(部分安卓手机的UC浏览器写完以后还是可以放大缩小)忽略将页面中的数字识别为电话号码<meta&nb... Read More >
201804-18 学习文件 阿里巴巴Java开发手册终极版.pdfJava编程思想第4版.pdfJSP教程.pdfJava企业设计模式.pdfSpring_3.x企业应用开发实战.pdf... Read More >
201804-17 Redis键命令 Redis键命令用于管理Redis中的键。以下是使用redis键命令的语法。语法redis 127.0.0.1:6379> COMMAND KEY_NAMEShell示例redis 127.0.0.1:6379> SET akey redis OK redis 127.0.0.1:6379> DEL akey (integer) 1... Read More >
201804-03 100个常用的linux命令 1,echo “aa” > test.txt 和 echo “bb” >> test.txt //>将原文件清空,并且内容写入到文件中,>>将内容放到文件的尾部 2,chmod go+w -R /home/zhangy //给组用户和其他用户添加写的权限 3,tar -tzvf test.... Read More >
201804-02 spring boot Exception parsing document: template="xxxxxxxx", line 17 - column 5的错误 Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Mon Apr 02 14:03:18 CST 2018There was an unexpected error (type=Internal Server Error, status=500).Exception parsing document: te... Read More >
201804-02 @Controller和@RestController的区别? @Controller和@RestController的区别?官方文档:@RestController is a stereotype annotation that combines @ResponseBody and @Controller.意思是:@RestController注解相当于@ResponseBody + @Controller合在一起的作用。1)如果只是使用@RestController注解Controller,则Controller中的方法无法返回jsp... Read More >
201803-23 Spring Boot中文文档(官方文档翻译 基于1.5.2.RELEASE) 作者:Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch, Andy Wilkinson, Marcel Overdijk, Christian Dupuis, Sébastien Deleuze, Michael Simons翻译:geekidentity持续更新:http://blog.geekidentity.com/spring/spring_boot_translation/1.5.2.REL... Read More >
201803-02 前端硬知识 1、 viewport <meta name="viewport" con\="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> // width &nb... Read More >