![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring boot
文章平均质量分 60
topEngineerr
个人邮箱drstime@163.com。欢迎交流。
展开
-
Mock bean失败一直为null
原来的代码如下:@Componentpublic class TargetChargeFinder { @Autowired ChargeRepository chargeRepository;mock beanchargeRepository一直失败,且其值一直为null。原因在于,测试的地方,对于TargetChargeFinder没有采取注入的方式加入测试类当中,而是new的 private TargetChargeFinder finder;..原创 2021-04-15 16:34:11 · 4655 阅读 · 0 评论 -
spring boot入门介绍及自动配置实现原理
Table of ContentsSpring Boot是什么?Spring Boot Starter约定1:项目结构层面的约定约定2:springMVC框架层面的约定和定制约定3:嵌入式web容器层面的约定和定制Automatically Configuration关于@SpringBootApplication这个注解@Configuration@Comp...原创 2018-08-20 23:38:08 · 444 阅读 · 0 评论 -
spring boot test 端口号一直为0
用springboot 2.2和junit5时,我需要完成一些integrationtest.在写integrationtest时我有如下的代码用于启动一个测试环境:import org.junit.Test;import org.junit.jupiter.api.extension.ExtendWith;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.boot....原创 2020-09-29 16:38:12 · 672 阅读 · 0 评论 -
RestTemplate如何使用get请求获取一个list
假设我们有class定义如下:@JsonIgnoreProperties(ignoreUnknown = true)public class Rate { private String name; private String code; private Double rate; // add getters and setters}同时我们定义了一个api返回这个类型的object的list,例如:public ResponseEntity<Li.原创 2020-09-21 17:36:23 · 2929 阅读 · 0 评论