美文网首页
SpringBoot学习-web(二)

SpringBoot学习-web(二)

作者: 迪奥炸 | 来源:发表于2018-03-26 16:28 被阅读0次

1、main函数上的@SpringBootApplication

2、Controller上面的注解——@RestController注解

3、方法上面的注解--@RequestMapping

4、测试类的注解

5、什么时候用@Autowired

[再重温一下,注入到Spring容器中的bean,就类似于new了一个实例对象出来,但是没有被使用]

[用@Component、@Controller、@Service、@Repository注解来定义bean,注入到Spring容器中]

[用@Autowired、@Resource、@Inject来使用bean]

[通过@Autowired自动装配方式,从(实现了IoC设计模式的)Spring容器中去查找到MockMvc,并返回给mockMvc]

相关文章

网友评论

      本文标题:SpringBoot学习-web(二)

      本文链接:https://www.haomeiwen.com/subject/icmrcftx.html