自定义redis-starter
摘要:1.创建redis-spring-boot-autoconfigure模块,依赖jedis模块 <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> </dependency> 1.创建redis-s
阅读全文
posted @
2022-06-01 23:51
阿霖找BUG
阅读(139)
推荐(0) 编辑
测试
摘要:@SpringBootTest,,,,如果和src文件夹中的主类路径一样就不用加(classes=主类名.class)Redis测试类 package com.example.springbootredis; import org.junit.jupiter.api.Test; import org
阅读全文
posted @
2022-05-30 19:13
阿霖找BUG
阅读(38)
推荐(0) 编辑
springboot内外部配置文件
摘要:1.file:./config/【优先级最高】2.file:./【优先级第二】3.classpath:/config/【类路径下的config,优先级第三】4.classpath:/【直接在类路径,优先级第四】 内外部的优先级都是一样的,不过外部配置是和内部进行互补,可以用外部的配置覆盖掉内部的 打
阅读全文
posted @
2022-05-30 17:36
阿霖找BUG
阅读(114)
推荐(0) 编辑
profile
摘要:在开发springboot是经常要把同一套程序安装几个环境中,eg:开发,测试,应用。其中的数据库地址,端口之类的一般不同,这时候我们就要用到profile来自由切换配置环境。 一.配置方式: 1.多个properties文件方式 这里的properties文件的命名为application-xxx
阅读全文
posted @
2022-05-28 02:37
阿霖找BUG
阅读(222)
推荐(0) 编辑
springboot第一步
摘要:package com.dark.horse.itim; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestControl
阅读全文
posted @
2022-05-27 23:06
阿霖找BUG
阅读(14)
推荐(0) 编辑
静态资源导入
摘要:文件运行后保存在resources中,resources目录下可以有public,static,resources,templates四个文件夹可以被访问到。优先级大到小resources,static(静态资源,比如图片),public(一般公共的资源),templates localhost:8
阅读全文
posted @
2022-05-02 00:48
阿霖找BUG
阅读(18)
推荐(0) 编辑
扩展springMVC
摘要:如果想diy一些定制化的功能,只要写这个组件,然后将它交给springboot,springboot就会帮我们自动装配 第一步加注解@Configuration,第二步继承WebMvcConfigurer,第三步自定义自己要的功能(重写),最后一步@Bean一下,ViewResolver實現了对应接
阅读全文
posted @
2022-05-01 01:21
阿霖找BUG
阅读(31)
推荐(0) 编辑
模板引擎
摘要:只要使用thymeleaf,只需要导入依赖 <!--thymeleaf模板,我们都基于3.x开发的--> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring5</artifactId> </depend
阅读全文
posted @
2022-05-01 01:12
阿霖找BUG
阅读(22)
推荐(0) 编辑
yaml
摘要:新建的person类 package com.example01.demo01.pojo; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.s
阅读全文
posted @
2022-04-28 17:25
阿霖找BUG
阅读(69)
推荐(0) 编辑
springboot的理解
摘要:关于SpringBoot,谈谈你的理解:自动装配???回头再了解 run(): 1.推断应用的类型是普通的项目还是Web项目2.查找并加载所有可用初始化器,设置到initializers属性中 3.找出所有的应用程序监听器,设置到listeners属性中4.推断并设置main方法的定义类,找到运行的
阅读全文
posted @
2022-04-28 10:56
阿霖找BUG
阅读(23)
推荐(0) 编辑