![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring boot
文章平均质量分 68
我的风格0.0
这个作者很懒,什么都没留下…
展开
-
常用注解,依赖,常用类,插件和其它(自用)
参考重点参考:java开发注解大全 这里面除了spring的常用注解以外,还有其它包的注解 比较全SpringBoot参考:SpringBoot注解大全下面是自己总结的自己笔记java注解大全参考:https://www.cnblogs.com/ranandrun/p/annotation.html实用的注解:@Controller 和 @RestController使用@Controller 注解,在对应的方法上,视图解析器可以解析return 的jsp,html..原创 2021-07-06 11:20:17 · 1573 阅读 · 0 评论 -
Spring,SpringBoot,Mybatis等全家桶细节笔记(自用,持续更新)
1、Spring @Configuration 和 @Component 区别:重点参考:Spring @Configuration 和 @Component 区别在项目中有时我们使用的是@Configuration加@Bean ,有时使用的是@Component加@Autowired或@Bean 来加载类,它们的主要区别在于:@Configuration中所有带@Bean注解的方法都会被动态代理,因此调用该方法返回的都是同一个实例。@Component等注解可以是单例也可以是......原创 2021-07-02 14:08:03 · 380 阅读 · 0 评论 -
Controller层使用@value注解获取不到 yml文件中的properties属性值
原因:@Value并不会主动去父容器中查找配置文件属性值,你要配置或注入用注入方式就获取到了@Servicepublic class PropertyService { @Value("${isc.app-id}") private String iscAppid;}在controller注入:@Autowiredprivate PropertyService propertyService;isc: app-id: 12121313456参考:https://w原创 2021-05-18 14:28:15 · 2564 阅读 · 0 评论 -
使用@Pattern@Validated校验 并抛出异常
基类里的属性regexp 是正则表达式一般默认就填入正则表达式即可,但是java中字符串需要转义,这个需要注意一下。基类 /** 标识码 */ @Pattern(regexp = "^\\d{11}$",message = "mis只能由数字组成") @ApiModelProperty("标识码") private String mis;控制层在传参或者controller层中的添加@Validated注解进行调用,我这里是在控制层添加控制层加上@Validat原创 2021-05-22 17:27:37 · 3228 阅读 · 0 评论