
Springboot注解
以章节的形式记录学习 Spring boot 2 receipes一书的注解
Herbzhou
立志成为好的博主,坚持博客
展开
-
Thymeleaf在spring boot 2 recipe中的用法笔记
@GetMapping("/books.html")public String all(Model model) {model.addAttribute("books", bookService.findAll());return "books/list";}Finally, we return the name of the view to render books/list. ...原创 2019-11-30 15:40:21 · 109 阅读 · 0 评论 -
spring boot recipes第二章 spring boot basics笔记
@Component标志一个类是一个bean,Spring Boot will detect this class and create a bean instance from itspring boot将会探测这个类并创建一个bean实例。@PostConstructor@PostConstruct annotated method is invoked after ...原创 2019-11-30 20:31:40 · 156 阅读 · 0 评论 -
spring boot recipes第三章 spring MVC注解笔记
@RestController @RestController 相当于@Controller+@ResponseBody两个注解的结合,返回json数据不需要在方法前面@ResponseBody注解了,但使用这个注解,就不能返回jsp,html页面,视图解析器无法解析jsp,html页面。简而言之:表明当前类是控制器且返回的是一组数据,不是页面@Controlle...原创 2019-11-30 19:38:06 · 135 阅读 · 0 评论