摘要: 1.使用interrupt关闭线程 /** * 使用interrupt关闭线程,注意不可强制,而是要判断true如果当前线程已被中断; false除此以外。!Thread.currentThread().isInterrupted() */public class RightWayStopThrea 阅读全文
posted @ 2021-11-02 17:57 创嗨 阅读(36) 评论(0) 推荐(0)
摘要: /** * run and start 区别 */public class StartAndRunMethod { public static void main(String[] args) { Runnable runnable = () ->{ System.out.println(Threa 阅读全文
posted @ 2021-11-02 13:13 创嗨 阅读(30) 评论(0) 推荐(0)
摘要: 都是在之前创建线程的基础上创建的线程 1. 利用线程池创建线程 1.哪个方法需要线程,比如Task里面的方法需要使用线程那么实现Runnable 2.用线程池的.submit去调用这个线程 public class ThreadPool5 { public static void main(Stri 阅读全文
posted @ 2021-11-02 09:38 创嗨 阅读(61) 评论(0) 推荐(0)
摘要: 1.考虑一下网上说的post get @RequestBody只支持POST请求,GET请求不能使用@RequestBody,修改GET请求为POST即可,如果需要使用GET请求,可以使用@RequestParam和@PathVariable 2.我的是因为:接收的实体类定义的是:String,结果 阅读全文
posted @ 2021-10-28 13:27 创嗨 阅读(2955) 评论(0) 推荐(0)
摘要: SpringBoot自带schedule 1.依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-quartz</artifactId></dependency> 2.代码 阅读全文
posted @ 2021-10-06 17:30 创嗨 阅读(193) 评论(0) 推荐(0)
摘要: 1.mapper类 @Mapper@Repository @Mapper和@Repository的区别 1.相同点@Mapper和@Repository都是作用在dao层接口,使得其生成代理对象bean,交给spring 容器管理对于mybatis来说,都可以不用写mapper.xml文件2.不同点 阅读全文
posted @ 2021-09-27 11:07 创嗨 阅读(75) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-09-27 10:32 创嗨 阅读(29) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-07-07 14:47 创嗨 阅读(109) 评论(0) 推荐(0)