spring boot——MockMvc的用法 1.pom配置 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> </dependency> 2.所需对象及Controller public class User { private String id; private
bean是Spring 最核心的东西,打个比方,假设Spring是一个水桶,那么bean就是水桶里的水,水桶离开水后,就没啥作用了.我们先来看一下bean的定义: public class Person { private String name; private int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int g
1.实现ApplicationListener接口,并重写onApplicationEvent方法 @Component public class RSAKeyInitListener implements ApplicationListener<ContextRefreshedEvent> { @Autowired BaseAppConfigDao baseAppConfigDao; @Override public void onApplicationEvent(ContextRefres