随笔分类 -  1202 SpringBoot

摘要:最近在项目中涉及到Excle的导入功能,通常是我们定义完模板供用户下载,用户按照模板填写完后上传;这里待下载模板位置为resource/excelTemplate/test.xlsx,尝试了四种读取方式,并且测试了四种读取方式分别的windows开发环境下(IDE中)读取和生产环境(linux下ja 阅读全文
posted @ 2021-09-04 19:54 panchanggui 阅读(544) 评论(0) 推荐(0) 编辑
摘要:[ERROR]Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method ‘elasticsearchClient’ threw exception; nested except 阅读全文
posted @ 2021-09-04 11:16 panchanggui 阅读(418) 评论(0) 推荐(0) 编辑
摘要:1、ctrl+Shift+Alt+/,选择Registry 2、勾选 compiler.automake.allow.when.app.running(可能不按首字母排序,可以多找找) 3、Setting >Compiler >勾选Build project automatically 4、pom. 阅读全文
posted @ 2021-07-25 11:31 panchanggui 阅读(1930) 评论(0) 推荐(0) 编辑
摘要:遇到一个问题,springboot升级成2.0后,从数据库查出来的日期,用Date接收,最后直接返回给前端,在谷歌浏览器中能正常显示成yyyy-MM-dd HH:mm:ss格式。但是在IE浏览器中日期显示的是“乱码”,因为springboot1.x版本的默认将Date字段返回的是时间戳 ,而谷歌、I 阅读全文
posted @ 2021-07-25 08:34 panchanggui 阅读(3198) 评论(0) 推荐(1) 编辑
摘要:Spring 注解 @Qualifier 详细解析 文章目录 1. 概述 2. 痛点 3. @Qualifier 4. @Qualifier VS @Primary 5. 通过名称来自动注入 6. 总结 1. 概述 今天带你了解一下 Spring 框架中的 @Qualifier 注解,它解决了哪些问 阅读全文
posted @ 2021-07-23 11:40 panchanggui 阅读(389) 评论(0) 推荐(0) 编辑
摘要:filter中无法使用@Autowired 原因 在Spring中,web应用启动的顺序是:listener->filter->servlet,先初始化listener,然后再来就filter的初始化,再接着才到我们的dispathServlet的初始化,因此,当我们需要在filter里注入一个注解 阅读全文
posted @ 2021-07-07 08:25 panchanggui 阅读(1402) 评论(0) 推荐(0) 编辑
摘要:在阅读本文之前可以先看看springsecurity的基本执行流程,下面我展示一些核心配置文件,后面给出完整的整合代码到git上面,有兴趣的小伙伴可以下载进行研究 使用maven工程构建项目,首先需要引入最核心的依赖, <dependency> <groupId>org.springframewor 阅读全文
posted @ 2021-07-06 18:22 panchanggui 阅读(899) 评论(0) 推荐(0) 编辑
摘要:其流程如下: 阅读全文
posted @ 2021-07-06 17:47 panchanggui 阅读(96) 评论(0) 推荐(0) 编辑
摘要:在SpringBoot中的SpringSecurity的配置类中,http.permitAll()与web.ignoring()的区别? 虽然这两个都是继承WebSecurityConfigurerAdapter后重写的方法,但是http.permitAll不会绕开springsecurity的过滤 阅读全文
posted @ 2021-07-06 11:04 panchanggui 阅读(13669) 评论(0) 推荐(4) 编辑
摘要:AuthenticationProvider 默认实现:DaoAuthenticationProvider 授权方式提供者,判断授权有效性,用户有效性,在判断用户是否有效性,它依赖于UserDetailsService实例,开发人员可以自定义UserDetailsService的实现。 additi 阅读全文
posted @ 2021-07-01 13:30 panchanggui 阅读(405) 评论(0) 推荐(0) 编辑
摘要:之前项目中都是使用shiro作为安全框架,但是很多资料推荐spring security作为spring项目的安全框架。既然用着spring,那spring security自然还是要了解下的。 但是在实际接触中发现,比shori的学习成本高点。还有就是大部分都停留在将前端代码放在后端路径下,页面的 阅读全文
posted @ 2021-06-24 21:04 panchanggui 阅读(1631) 评论(0) 推荐(0) 编辑
摘要:废话少说,直接上代码 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework 阅读全文
posted @ 2021-05-21 08:09 panchanggui 阅读(325) 评论(0) 推荐(0) 编辑
摘要:@Autowired是根据类型进行自动装配的。如果当Spring上下文中存在不止一个UserDao类型的bean时,就会抛出BeanCreationException异常;如果Spring上下文中不存在UserDao类型的bean,也会抛出BeanCreationException异常。我们可以使用 阅读全文
posted @ 2021-05-20 15:09 panchanggui 阅读(85) 评论(0) 推荐(0) 编辑
摘要:spring不但支持自己定义的@Autowired注解,还支持几个由JSR-250规范定义的注解,它们分别是@Resource、@PostConstruct以及@PreDestroy。 @Resource的作用相当于@Autowired,只不过@Autowired按byType自动注入,而@Reso 阅读全文
posted @ 2021-05-20 15:08 panchanggui 阅读(101) 评论(0) 推荐(0) 编辑
摘要:@Scheduled注解的使用这里不详细说明,直接对8个参数进行讲解。 参数详解 1. cron 该参数接收一个cron表达式,cron表达式是一个字符串,字符串以5或6个空格隔开,分开共6或7个域,每一个域代表一个含义。 cron表达式语法 [秒] [分] [小时] [日] [月] [周] [年] 阅读全文
posted @ 2021-05-07 15:54 panchanggui 阅读(1040) 评论(0) 推荐(0) 编辑
摘要:springboot获取当前项目路径的地址 System.getProperty("user.dir") 输出目录: G:\outshine\wangsoso //获取classes目录绝对路径 String path = ClassUtils.getDefaultClassLoader().get 阅读全文
posted @ 2021-05-06 19:38 panchanggui 阅读(5899) 评论(0) 推荐(0) 编辑
摘要:spring为开发者提供了一个名为spring-boot-devtools的模块来使Spring Boot应用支持热部署,提高开发者的开发效率,无需手动重启Spring Boot应用。 devtools的原理 深层原理是使用了两个ClassLoader,一个Classloader加载那些不会改变的类 阅读全文
posted @ 2021-05-06 14:49 panchanggui 阅读(131) 评论(0) 推荐(0) 编辑
摘要:问题描述:在集群模式部署服务端时,会出现所有的定时任务在各自的节点处均会执行一遍,这显然不符合实际的开发场景,针对这种问题,本文给出一种springboot集成shedlock的解决方案 第一步:引入相关包; <!-- 负载均衡定时任务执行一次 --> <dependency> <groupId>n 阅读全文
posted @ 2021-05-06 14:31 panchanggui 阅读(1036) 评论(0) 推荐(0) 编辑
摘要:写了个简单的Springboot工程,启动时始终会报错: “If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded 阅读全文
posted @ 2021-04-28 17:33 panchanggui 阅读(3626) 评论(0) 推荐(1) 编辑
摘要:Docker这门技术也是开发中我们值得掌握的一门技术。接下我们就来探究一下, 怎么使用Docker容器化的技术来构建并运行,Spring Boot项目的可执行Jar包。 演示环境 CentOS 7 Docker 1.13.1 Spring Boot 2.1.1.RELEASE 准备一个Spring 阅读全文
posted @ 2021-04-25 11:09 panchanggui 阅读(1661) 评论(0) 推荐(0) 编辑