随笔分类 -  Spring

摘要:A、@SessionAttributes org.springframework.web.bind.annotation.SessionAttributes public @interface SessionAttributes Annotation that indicates the sessi 阅读全文
posted @ 2021-12-29 22:48 哩个啷个波 阅读(301) 评论(0) 推荐(0) 编辑
摘要:参考一: @ModelAttribute使用详解 1.@ModelAttribute注释方法 例子(1),(2),(3)类似,被@ModelAttribute注释的方法会在此controller每个方法执行前被执行,因此对于一个controller映射多个URL的用法来说,要谨慎使用。 (1)@Mo 阅读全文
posted @ 2021-12-29 22:48 哩个啷个波 阅读(1686) 评论(0) 推荐(0) 编辑
摘要:参考一: @Valid 用于验证注解是否符合要求,直接加在变量user之前,在变量中添加验证信息的要求,当不符合要求时就会在方法中返回message 的错误提示信息。 然后在 User 类中添加验证信息的要求: @NotBlank 注解所指的 password 字段,表示验证密码不能为空,如果为空的 阅读全文
posted @ 2021-12-29 22:10 哩个啷个波 阅读(637) 评论(0) 推荐(0) 编辑
摘要:参考一 what? BeanUtils它提供了对java反射和自省API的包装。它里面还有很多工具类,这里我们介绍一下copyProperties。 why? 我们如果有两个具有很多相同属性的JavaBean,一个很常见的情况就是Struts里的PO对象(持久对象)和对应的ActionForm,传统 阅读全文
posted @ 2021-12-29 21:39 哩个啷个波 阅读(2032) 评论(0) 推荐(0) 编辑
摘要:问题描述SpringBoot 项目中使用了Druid连接池,启动项目时,log中打印出下面的错误信息,但是不影响程序的运行:com.alibaba.druid.filter.FilterManager : load filter error, filter not found : sl4j 问题解决 阅读全文
posted @ 2021-12-28 21:11 哩个啷个波 阅读(588) 评论(0) 推荐(0) 编辑
摘要:1.第一种参考: @Resource和@Autowired都是做bean的注入时使用,其实@Resource并不是Spring的注解,它的包是javax.annotation.Resource,需要导入,但是Spring支持该注解的注入。 1、共同点 两者都可以写在字段和setter方法上。两者如果 阅读全文
posted @ 2021-12-28 21:08 哩个啷个波 阅读(839) 评论(0) 推荐(0) 编辑
摘要:@Controller、@RestController注解区别: @RestController 注解相当于 @Controller + @ResponseBody 合在一起的作用 一、@Controller注解 @Controller 是Spring框架提供的注解。 @Controller标识的类 阅读全文
posted @ 2021-12-28 20:53 哩个啷个波 阅读(845) 评论(0) 推荐(0) 编辑
摘要:写了一个idea测试类使用@Test然后报错,造成报错的可能原因: 1、首先是检查是不是因为自己懒在创建类的时候将类名写成了Test 如果类名为Test的话,也无法使用,但是可以使用完全限定名。 2、使用的jar包版本号过低 @Test注解只有junit4以上的版本可以使用,如果使用的是低版本的不能 阅读全文
posted @ 2021-11-08 14:18 哩个啷个波 阅读(2763) 评论(0) 推荐(1) 编辑
摘要:查阅了下资料,原理是: 在Spring Boot 2.2.X以后使用import org.junit.jupiter.api.Test Junit5 在Spring Boot 2.2.x之前使用import org.junit.Test Junit4 阅读全文
posted @ 2021-11-08 14:11 哩个啷个波 阅读(1158) 评论(0) 推荐(1) 编辑

点击右上角即可分享
微信分享提示