
spring-boot
文章平均质量分 56
sayyy
这个作者很懒,什么都没留下…
展开
-
SpringBoot 配置上下文路径 server.servlet.context-path
略原创 2024-05-31 21:53:07 · 763 阅读 · 0 评论 -
spring cloud 修改bootstrap文件的文件名
略原创 2023-12-10 01:18:36 · 291 阅读 · 0 评论 -
HTTP 响应头 X-Frame-Options
略原创 2023-10-14 10:53:58 · 5227 阅读 · 0 评论 -
spring-boot: redis cache TTL 选项
略原创 2023-07-05 14:47:38 · 799 阅读 · 0 评论 -
@Value设置默认值
略原创 2023-04-19 19:55:15 · 316 阅读 · 0 评论 -
【spring-boot】配置redis
略原创 2023-04-19 19:01:42 · 192 阅读 · 0 评论 -
【spring-boot】@EnableCaching 和 CacheAutoConfiguration
略原创 2023-04-19 18:39:56 · 328 阅读 · 0 评论 -
【spring-boot】Redis 自动配置类 RedisAutoConfiguration
略原创 2023-04-19 11:33:22 · 410 阅读 · 0 评论 -
spring boot 在方法内部调用事务方法时不生效
略原创 2023-01-31 11:49:10 · 94 阅读 · 0 评论 -
Spring Boot 默认数据源 HikariDataSource
略原创 2023-01-31 11:32:35 · 2875 阅读 · 0 评论 -
Springboot 启用 ehcache缓存
Springboot 启用 ehcache缓存原创 2022-12-26 09:46:58 · 828 阅读 · 0 评论 -
spring-boot 请求参数校验:注解 @Validated 的使用、手动校验、自定义校验
spring-boot中可以用@validated来校验数据,如果数据异常则会统一抛出异常,方便异常中心统一处理。spring-boot已经引入了基础包,所以直接使用就可以。原创 2022-11-25 20:41:39 · 9064 阅读 · 1 评论 -
【spring-boot】使用jackson操作JSON
SpringMVC自带jackson,其内置的JSON解析器就是jackson。原创 2022-07-13 18:11:30 · 493 阅读 · 0 评论 -
spring boot 文件上传大小限制
MULTIPART (MultipartProperties)原创 2022-06-27 16:08:25 · 1652 阅读 · 0 评论 -
Spring Scheduling 调度/定时任务
前言spring boot 2.2.13.RELEASEScheduling实例创建 spring boot 项目pom.xml<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mav原创 2022-04-29 19:48:53 · 1392 阅读 · 0 评论 -
【spring-boot】【spring-session】FilterRegistrationBean
前言spring-bootspring-sessionruoyiFilterRegistrationBean 什么时候生效?从 TomcatStarter.onStartup 到 ServletContextInitializerBeans.getOrderedBeansOfType 的调用过程。TomcatStarter.onStartup ServletContextInitializer.onStartup AnnotationConfigServletWebServerA原创 2022-04-15 16:16:00 · 563 阅读 · 0 评论 -
【spring-boot】集成【spring-session】,使用 redis 存储 session
前言在 【spring-boot】自动配置【spring-session】 过程基础上改进。说明如需要在redis中存储session,则创建SessionRepository 的redis实现即可。操作引入spring-boot的redis支持包。<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-r原创 2022-04-15 15:34:03 · 690 阅读 · 0 评论 -
【spring-boot】自动配置【spring-session】 过程
前言springboot项目仅引用 spring-session-core开发者自己提供 SessionRepositoryspring-boot 项目启用 spring-sessionspring-boot 项目引入spring-session-core:<dependency> <groupId>org.springframework.session</groupId> <artifactId>spring-session-原创 2022-04-15 15:07:03 · 3179 阅读 · 0 评论 -
错误:No plugin found for prefix spring-boot in the current project and in the plugin groups
前言maven 3.6.1springboot v2.1.x在多模块的 Maven 项目中,执行 mvn spring-boot:run -pl xxx.groupId:xxx.artifactId命令启动某个 Module 。错误:No plugin found for prefix spring-boot in the current project and in the plugin groups在多模块的 Maven 项目中,使用 spring-boot:run 执行启动时,遇到错误:原创 2022-04-11 09:36:08 · 7651 阅读 · 0 评论 -
Springboot : RequestContextHolder
前言springboot 2.0.0.RELEASEsping-web 提供了 RequestContextHolder 。RequestContextHolder 让开发者可以在请求的任意位置获取到 request、response、session 等。因 RequestContextHolder 是 sping-web 提供的,所以 springboot 中也可以使用。获取请求参数RequestAttributes requestAttributes = RequestContextHol原创 2021-11-03 18:00:43 · 2129 阅读 · 0 评论 -
ajax跨域问题
浏览器的同源策略浏览器的同源策略参考这里,这里,这里。源(origin):协议(比如:http)、域名(比如:localhost)、端口号(比如:8080)共同表示一个源。同源:协议、域名、端口号相同。同源策略(same origin policy):它是一个重要的安全策略,用于限制一个origin的文档或者它加载的脚本如何能与另一个源的资源进行交互。同源策略是由w3c为浏览器指定的一个策略,它能帮助阻隔恶意文档,减少可能被攻击的媒介。什么是跨域问题?跨域问题来源于浏览器的"同源策略"(即原创 2021-11-01 16:39:54 · 948 阅读 · 0 评论 -
【SpringBoot Testing】测试类/测试用例格式
这里写目录标题前言Test Scope Dependencies编写测试用例测试用例该放哪个`package`中前言springboot 2.3.5.RELEASETest Scope Dependencies需要引入“spring-boot-starter-test”:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-原创 2021-06-03 14:18:53 · 854 阅读 · 0 评论 -
【Mybatis】sqlSessionTemplate.getConnection() 遇到 java.sql.SQLException: Connection is closed
这里写目录标题前言源码遇到错误 `java.sql.SQLException: Connection is closed`错误原因解决办法修改后的源码前言springboot 2.1.1.RELEASE源码@Repositorypublic class TestDao { @Autowired private SqlSessionTemplate sqlSessionTemplate; public void printSysConfig() { String sql = "原创 2021-06-02 22:14:35 · 3202 阅读 · 2 评论 -
springboot @RequestBody 接收字符串
前言springboot 2.1.1.RELEASE@RequestBody 接收字符串 @RequestMapping(method = {RequestMethod.POST}) public ResultEntity form1(@RequestBody String requestBody) throws UnsupportedEncodingException { logger.info("================ request body ==========原创 2021-06-02 00:18:25 · 21867 阅读 · 0 评论 -
springboot yaml/yml配置文件字符串换行
前言springboot 2.1.1.RELEASEyaml配置文件字符串换行需要把RSA公钥放到配置文件中,因字符串太长,为了方便维护,将公钥换行。publicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqnbBj7B2g5uC3EoGus63\ U1vZQn7BZt7G/3W2+QV5+hVQiqMckWthulWfwcL45iQKCQdJha1Gt33ittoyYrOX\ q1CS8kO原创 2021-06-01 23:58:04 · 2739 阅读 · 0 评论 -
【Spring MVC】Type mismatch: cannot convert from String to Date
前言ruoyi 4.6.0spring boot 2.2.13.RELEASE错误:Type mismatch: cannot convert from String to Date10:39:52.188 [http-nio-9020-exec-7] ERROR c.r.f.w.e.GlobalExceptionHandler - [validatedBindException,103] - org.springframework.validation.BeanPropertyBindingR原创 2021-05-28 11:32:07 · 2813 阅读 · 0 评论 -
Spring @Value 设置默认值
前言springboot 2.1.1.RELEASE@Value 未设置默认值时的表现org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: C原创 2021-05-21 11:59:58 · 1053 阅读 · 0 评论 -
UriComponentsBuilder 拼接URL、解析URL
前言关于URI参考这里。springboot 2.1.1.RELEASEUriComponentsBuilderUriComponentsBuilder 是UriBuilder的实现。针对Servlet,还派生出来ServletUriComponentsBuilder。使用过UriComponentsBuilder 的都知道,很好用快速来个示例String url = UriComponentsBuilder.fromUriString("http://mydomain/api/ge原创 2021-05-19 12:31:00 · 13504 阅读 · 3 评论 -
【thymeleaf】【SpringBoot】Thymeleaf 获取.properties中的配置项变量
前言略。Thymeleaf 获取.properties中的配置项变量假设我在 Thymeleaf 中写JavaScript的时候,发现我需要读取application.properties中的配置项变量,该怎么办呢?application.propertiesfoo.bar=somethingThymeleaf<script th:inline="javascript">alert("伪代码:application.properties中的配置foo.bar");</原创 2021-05-16 19:12:07 · 2256 阅读 · 0 评论 -
【spring boot】【POI】错误:The supplied data appears to be in the Office 2007+ XML
前言spring boot 2.1.1.RELEASEpoi 5.0.0错误Caused by: org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call原创 2021-05-07 16:19:34 · 976 阅读 · 0 评论 -
【spring-session】store-type
前言spring-session 2.0.2.RELEASEspring boot 2.1.1.RELEASEspring boot 中使用 spring-session 的说明https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/htmlsingle/#boot-features-sessionYou can disable Spring Session by setting the store-type to no原创 2021-05-07 10:07:38 · 3773 阅读 · 0 评论 -
【SpringBoot】【Thyemeleaf 】【Spring EL表达式】 SPEL调用静态类、静态方法
前言spring 5.0.6.RELEASEThyemeleaf 3.0SpringBoot 2.3.4.RELEASESpring EL表达式 调用静态类、静态方法参考这里:https://docs.spring.io/spring-framework/docs/5.0.6.RELEASE/spring-framework-reference/core.html#expressions-typesThe special T operator can be used to specify原创 2021-04-21 17:37:19 · 2915 阅读 · 0 评论 -
【sprinb-boot】排除/不加载某些Bean
前言springboot 2.0.0.RELEASEmaven 3.5.0这里介绍内容为,在spring boot启动时,排除/不加载某些Bean。spring boot启动时,排除/不加载某些模块/AutoConfiguration类,看这里。排除/不加载某些Bean排除/不加载某些Bean时,需要使用@ComponentScan。具体做法,可以采用下面的方式:方式1:自定义 @ComponentScan方式2:自定义 @ComponentScans方式3:自定义 TypeExclu原创 2021-04-17 15:28:50 · 30993 阅读 · 1 评论 -
【springboot】禁用特定AutoConfiguration/自动配置类
前言spring boot 2.0.0.RELEASE官方说明https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#using-boot-disabling-specific-auto-configuration原创 2021-04-17 11:22:22 · 1918 阅读 · 0 评论 -
Caused by: org.springframework.amqp.AmqpException: No method found for class [B
前言spring boot 2.2.13.RELEASE错误内容:Caused by: org.springframework.amqp.AmqpException: No method found for class [B11:06:57.392 [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#6-1] WARN o.s.a.r.l.ConditionalRejectingErrorHandler - [log,原创 2021-04-06 16:17:20 · 4419 阅读 · 0 评论 -
Description Resource Path Location Type Path must include project and resource name: /
前言eclipse 2019-12 (4.14.0)jdk 1.8Apache Maven 3.6.1spring boot 2.2.13.RELEASE错误Description Resource Path Location TypePath must include project and resource name: / (org.apache.maven.plugins:maven-jar-plugin:2.4:jar:default-jar:package)java.lang原创 2021-03-17 11:06:33 · 938 阅读 · 0 评论 -
【spring boot】支持webjars
前言spring boot 2.4.3spring boot 支持webjars通过添加 ResourceHandlerRegistry 实现。参考WebMvcConfigurationSupport。pom.xml<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSc原创 2021-03-14 14:19:04 · 819 阅读 · 0 评论 -
JSP页面中调用Spring Bean
前言spring boot 2.0.3.RELEASEspring mvc view : jspJSP页面中调用Spring Bean在 JSP 页面获得 WebApplicationContext 。通过 WebApplicationContext 获取 Bean 的实例。通过 Bean 的实例调用 Bean 内的方法。在 JSP 页面获得 WebApplicationContext方法1<%@page import="org.springframework.web.co原创 2020-12-15 14:35:59 · 720 阅读 · 0 评论 -
【spring boot】【thymeleaf】SPEL调用静态方法和静态属性
前言spring boot 2.1.1.RELEASEthymeleaf 3.0静态属性<sapn th:text="${T(java.lang.Math).PI}">PI</span>效果:静态方法<sapn th:text="${T(java.lang.Math).random()}" >random</span>效果:原创 2020-10-30 16:40:06 · 1501 阅读 · 0 评论 -
【spring boot】【thymeleaf】SPEL处理 null 值
List 类型数组越界数组越界时,错误是这样的:Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "slist[2].score" (template: "exam/papers/edit" - line 117, col 92)Caused by: org.springframework.expression.spel.SpelEvalu原创 2020-10-30 16:10:12 · 4792 阅读 · 0 评论