![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring boot
文章平均质量分 76
学不会编程的男孩
这个作者很懒,什么都没留下…
展开
-
微服务学习笔记
使用RestTemplate 直接连其他服务 例如订单服务调用用户服务里用户的信息,RestTemplate 就是使用http协议调用的 先在任意配置文件中把RestTemplate 组件加入到Spring容器 @Bean public RestTemplate restTemplate(){ return new RestTemplate(); } 在service调用服务 @Autowired private RestTemplate restTemplate;原创 2022-10-08 14:34:37 · 221 阅读 · 0 评论 -
spring security 和shiro简单使用
spring security 引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> 编写配置类 package com.config; import原创 2022-01-14 17:59:54 · 1925 阅读 · 0 评论 -
springboot常用功能简单开发
异步任务 在主启动类加上@EnableAsync(自动开启异步任务) @EnableAsync public class bootMain { public static void main(String[] args){ SpringApplication.run(bootMain.class,args); } } 在异步的类上添加@Async @Service @Async public class UserServiceImpl extends ServiceImp原创 2022-01-11 17:51:20 · 240 阅读 · 0 评论 -
springboot2学习笔记
springboot自动配置特性 ①spring-boot-starter-web包下引入了tomcat依赖 ②自动配好了springmvc所有组件,SpringApplication.run(MainApplication.class, args)返回我们IOC容器,可以查看出来 springboot主程序自动配置的三大注解:①@ComponentScan 指定扫描路径 ②@SpringBootConfiguration ③@EnableAutoConfiguration @Configuration @原创 2022-01-07 17:47:40 · 811 阅读 · 0 评论 -
springBoot常用注解
@PropertySource(“classpath:/properties/image.properties”),指定配置文件,进行属性注入 ,将key-value交给spring容器管理,常用语把数据写在properties里,然后在程序中用此注解调取需要的数据的路径,然后通过注解@Value()获取,如@Value("${image.localDir}"),好处是防止把可能会改变的数据在业务层中写死,有需求可直接在配置文件properties里修改。 ...原创 2021-03-22 15:54:09 · 262 阅读 · 0 评论