SpringBoot
文章平均质量分 85
我们要做到能够熟练使用SpringBoot
AlluzeYu
这个作者很懒,什么都没留下…
展开
-
014-SpringBoot-Thymeleaf的字面量+运算符+基本对象
1、Thymeleaf的字面量1.1 什么是thymeleaf的字面量字面量:对应数据类型的合法取值,可以在 html 页面直接使用,不需要后台传递1.2 创建module1.3 编写pojo-User类package com.zzy.springboot.pojo;import lombok.Data;@Datapublic class User { private Integer id; private String name;}1.4 编写Liter原创 2021-06-04 14:50:02 · 231 阅读 · 2 评论 -
013-springboot-thymeleaf-常用属性
1、创建 SpringBoot 的 web 项目并使用模版引擎1.1 创建module020-springboot-thymeleaf-property1.2 查看pom文件的依赖pom.xml中应该有以下两个依赖1.3 编辑核心配置文件1.4 引入lombok依赖 <dependency> <groupId>org.projectlombok</groupId> <artifactId>lom原创 2021-06-02 15:52:20 · 3094 阅读 · 2 评论 -
012-SpringBoot-Thymeleaf 的表达式
1.创建module1.1 创建 SpringBoot 的 web 项目并使用模版引擎1、创建module018-springboot-thymeleaf-expression引入web和模板引擎创建完成后pom.xml文件中会有如下依赖坐标 <dependency> <groupId>org.springframework.boot</groupId> <artifactId&g原创 2021-05-29 14:03:26 · 240 阅读 · 1 评论 -
011-SpringBoot中Thymeleaf------入门
1.认识ThymeleafThymeleaf 的官方网站:http://www.thymeleaf.orgThymeleaf 官方手册:https://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.htmlThymeleaf 是一个流行的模板引擎,该模板引擎采用 Java 语言开发,模板引擎是一个技术名词,是跨领域跨平台的概念,在 Java 语言体系下有模板引擎,在 C#、PHP 语言体系下也有模板引擎,甚至在 JavaScript 中原创 2021-05-12 11:32:52 · 186 阅读 · 1 评论 -
010-SpringBoot整合Dubbo(Zookeeper)
1.开发Dubbo服务接口1.1 创建普通maven工程014-springboot-dubbo-interface1.2 创建StudentService接口package com.zzy.springboot.service;public interface StudentService { //获取学生总人数 Integer queryStudentCount();}2. 开发Dubbo服务提供者2.1 创建SpringBoot-W原创 2021-05-08 11:48:11 · 104 阅读 · 0 评论 -
009-SpringBoot整合Redis
1、案例思路完善根据学生 id 查询学生的功能,先从 redis 缓存中查找,如果找不到,再从数据库中查找,然后放到 redis 缓存中2、创建module013-springboot-redis3、代码编写3.1 引入redis依赖 <!--springboot集成redis的起步依赖--> <dependency> <groupId>org.springframework.boot</groupId>原创 2021-05-07 16:37:33 · 106 阅读 · 0 评论 -
008-SpringBoot的restful的使用
1.Springboot下的SpringMVC注解1.1 注解解释1.1 Controller注解Spring MVC 的注解,处理 http 请求1.2 @RestController注解Spring 4 后新增注解,是@Controller 注解功能的增强是 @Controller 与@ResponseBody 的组合注解如果一个 Controller 类添加了@RestController,那么该 Controller 类下的所有方法都相当于添加了@ResponseBody 注解用原创 2021-05-07 10:55:17 · 263 阅读 · 1 评论 -
007-SpringBoot整合Mybatis---(@Transactional注解事务)
1.@Transactional注解1.1 spring有编程式事务和声明式事务:一般都比较推荐使用声明式事务。因为编程式事务与业务代码具有一定的耦合性质,在做改动的时候势必会牵连到主业务,所以一般都会使用推荐的声明式事务,即使用注解的方法来进行结构。这篇只看声明式事务的办法。即@Transactional注解1.2 @Transactional的用法使用@Transactional注解都是用在类的方法上。官网也不建议使用在接口类上面,注解肯定都是用到了aop的思想,即使用了动态代理。而如果使用原创 2021-04-30 15:26:07 · 2661 阅读 · 2 评论 -
006-SpringBoot整合MyBatis---方式二(将接口和映射文件分开)
1.创建module010-springboot-mybatis2.原创 2021-04-29 11:22:10 · 166 阅读 · 0 评论 -
005-SpringBoot整合MyBatis-----方式一(接口和映射文件在同一个包下)
1.创建module009-springboot-mybatis2. 案例思路通过 SpringBoot +MyBatis 实现对数据库学生表的查询操作2.1 准备数据库创建新的数据库 springboot,指定数据库字符编码为 utf-8创建t_student表,插入数据表t_student的sql文件DROP TABLE IF EXISTS `t_student`;CREATE TABLE `t_student` ( `id` int(10) NOT原创 2021-04-27 16:05:49 · 362 阅读 · 0 评论 -
004--SpringBoot整合jsp
1.创建module008-springboot-jsp2.添加依赖2.1 < dependencies>标签中添加依赖<!-- 添加servlet依赖模块 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId>原创 2021-04-27 10:52:18 · 151 阅读 · 0 评论 -
003---SpringBoot 自定义配置--注解@Value和@ConfigurationProperties的使用案例详解
1.Spring Boot 自定义配置在 SpringBoot 的核心配置文件中,除了使用内置的配置项之外,我们还可以在自定义配置,然后采用如下注解去读取配置的属性值2. @Value注解作用:用于逐个读取 application.properties 中的配置2.1 创建module006-springboot-custom-configuration2.2 在核心配置文件中自定义内容2.3 在Controller类中获取自定义配置信息在 SpringBootControll原创 2021-04-25 19:21:53 · 719 阅读 · 0 评论 -
002--Springboot集成SpringMVC (002-003-004-005)
1.入门案例项目名称:002-springboot-springmvc2.创建一个新的 Module2.1 选择类型为 Spring Initializr2.2 指定 GAV 及 pom 配置信息2.3 选择 Spring Boot 版本及依赖2.4 修改 Content Root 路径及文件所在目录2.5 对 POM.xml 文件进行解释<?xml version="1.0" encoding="UTF-8"?><project xmlns="h原创 2021-04-25 11:24:33 · 320 阅读 · 0 评论 -
001--SpringBoot-First(入门案例步骤)
1 如何创建一个springboot框架web项目2 使用springboot继承springmvc3 使用springboot框架核心配置文件application.properties4 使用springboot核心配置文件application.yml或者application.yaml5 springboot框架的核心配置application.properties或者application.yml或者application.yaml的区别6 多环境下核心配置文件的使用(propertie原创 2021-04-01 10:46:04 · 404 阅读 · 1 评论