上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 234 下一页

2022年6月17日

Java中的三种校验注解的使用(@Valid,@Validated和@PathVariable)

摘要: 目录 @Valid和@Validated @Valid和@Validated比较 @Valid高级使用 @Valid级联校验 @Validated高级使用 @Validated分组校验 @Validated分组校验顺序 @Validated非实体类校验 @PathVariable 正则表达式校验 继 阅读全文

posted @ 2022-06-17 16:37 ExplorerMan 阅读(5466) 评论(0) 推荐(0)

2022年6月15日

并发基础篇(六):线程Thread类的start()方法和run()方法

摘要: https://blog.csdn.net/sihai12345/category_7623860.html 一、初识java的线程是通过java.lang.Thread类来实现的。VM启动时会有一个由主方法所定义的线程。可以通过创建Thread的实例来创建新的线程。每个线程都是通过某个特定Thre 阅读全文

posted @ 2022-06-15 20:43 ExplorerMan 阅读(1217) 评论(0) 推荐(0)

Java开发之@PostConstruct和@PreConstruct注解

摘要: Java开发之@PostConstruct和@PreConstruct注解从Java EE5规范开始,Servlet增加了两个影响Servlet生命周期的注解(Annotation):@PostConstruct和@PreConstruct。这两个注解被用来修饰一个非静态的void()方法.而且这个 阅读全文

posted @ 2022-06-15 20:33 ExplorerMan 阅读(281) 评论(0) 推荐(0)

Java中@Qualifier注解

摘要: 当使用@Autowired注解按照组件类型进行注入时,若存在多个相同类型的组件时,spring就不知道该注入哪个了。此时就可以在多个相同类型的组件上使用@Component("组件名")或者@Qualifier("组件名")等将其进行区分,然后在要自动注入的地方使用@Autowired+@Quali 阅读全文

posted @ 2022-06-15 20:30 ExplorerMan 阅读(843) 评论(0) 推荐(0)

@Autowired(required=false)注入注意的问题

摘要: 1、前言 在使用spring开发过程中,我们基本上都是使用@Autowired这个注解,用来注入已有的bean。但是有些时候,会注入失败。当我们加上参数(required=false)就能解决。今天整理一个我在实际开发中的例子 2、required属性 @Autowired(required=tru 阅读全文

posted @ 2022-06-15 20:28 ExplorerMan 阅读(769) 评论(0) 推荐(0)

SpringBoot的 CommandLineRunner的使用

摘要: 用途 Spring boot的CommandLineRunner接口主要用于实现在应用初始化后,去执行一段代码块逻辑,这段初始化代码在整个应用生命周期内只会执行一次。 使用方式:1: 和@Component 注解配合 @Componentpublic class InitCompetition im 阅读全文

posted @ 2022-06-15 19:58 ExplorerMan 阅读(597) 评论(0) 推荐(0)

java springMVC之@RequestMapping注解

摘要: 目录 @RequestMapping注解 注解标识位置 value属性 method属性 params属性 headers属性 ant风格路径 路径占位符 @RequestMapping注解@RequestMapping注解的作用就是将请求和处理请求的控制器方法关联起来,建立映射关系。 Spring 阅读全文

posted @ 2022-06-15 19:54 ExplorerMan 阅读(505) 评论(0) 推荐(0)

Java @RestController注解

摘要: @RestController @RestController 相当于@Controller+@ResponseBody两个注解的结合,返回json数据不需要在方法前面加@ResponseBody注解了,但使用@RestController这个注解,就不能返回jsp,html页面,视图解析器无法解析 阅读全文

posted @ 2022-06-15 19:49 ExplorerMan 阅读(206) 评论(0) 推荐(0)

SpringBoot的配置文件bootstrap与application的作用以及区别

摘要: SpringBoot中有以下两种配置文件bootstrap (.yml 或者 .properties),application (.yml 或者 .properties)1.加载顺序上的区别bootstrap.yml(bootstrap.properties)先加载application.yml(a 阅读全文

posted @ 2022-06-15 17:30 ExplorerMan 阅读(3355) 评论(0) 推荐(1)

注解@Component、@Controller、@Service、@Repository的区别?

摘要: 主题:注解@Component、@Controller、@Service、@Repository的区别? Spring 2.5 中除了提供 @Component 注释外,还提供了几个特殊语义的注释:@Repository、@Service、@Controller。 其实,这三个注释和@Control 阅读全文

posted @ 2022-06-15 17:27 ExplorerMan 阅读(313) 评论(0) 推荐(0)

上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 234 下一页

导航