Spring Boot快速入门

目录

1、Spring Boot概述

1.1、什么是Spring Boot

1.2、Spring Boot的特点

2、Spring Boot快速入门

2.1、起步依赖

2.2、创建启动类

2.3、测试启动类

2.4、自定义banner

2.5、自动配置原理

2.6、启动类注解 

3、Spring Boot整合SpringMVC

3.1、Controller类

3.2、注意事项

3.3、热部署

3.4、application.properties配置文件

3.5、application.yml配置文件

3.6、多环境配置文件

3.7、Spring Boot访问jsp

4、快速构建Spring Initializr

4.1、方式一:官方模版

4.2、方式二:阿里云模版

5、Spring Boot使用Thymeleaf

5.1、Thymeleaf概述

5.2、添加依赖

5.3、thymeleaf模版配置

5.4、变量

5.5、对象变量

5.6、集合变量

5.7、获取value值

5.8、获取session值

5.9、if判断

5.10、引入连接

6、Spring Boot整合Mybatis

6.1、搭建工程

6.2、数据库准备

6.3、实体类

6.4、controller层

6.5、service层

6.6、mapper层

6.7、UserMapper.xml映射文件

6.8、启动类

6.9、页面 

6.10、测试

6.11、使用ajax请求


1、Spring Boot概述

1.1、什么是Spring Boot

Spring 诞生时是 Java 企业版(Java Enterprise Edition,JEE,也称 J2EE)的轻量级代替品。无需开发重量级的 Enterprise JavaBean(EJB),Spring 为企业级 Java 开发提供了一种 相对简单的方法,通过依赖注入和面向切面编程,用简单的 Java 对象(Plain Old Java Object, POJO)实现了 EJB 的功能。

虽然 Spring 的组件代码是轻量级的,但它的配置却是重量级的。一开始,Spring 用 XML 配置,而且是很多 XML 配置。Spring 2.5 引入了基于注解的组件扫描,这消除了大量针对 应用程序自身组件的显式 XML 配置。Spring 3.0 引入了基于 Java 的配置,这是一种类型安 全的可重构配置方式,可以代替 XML。所有这些配置都代表了开发时的损耗。因为在思考 Spring 特性配置和解决业务问题之间需要进行思维切换,所以写配置挤占了写应用程序逻 辑的时间。和所有框架一样,Spring 实用,但与此同时它要求的回报也不少。 除此之外,项目的依赖管理也是件吃力不讨好的事情。决定项目里要用哪些库就已经够让人头痛的了,你还要知道这些库的哪个版本和其他库不会有冲突,这难题实在太棘手。并且,依赖管理也是一种损耗,添加依赖不是写应用程序代码。一旦选错了依赖的版本,随之 而来的不兼容问题毫无疑问会是生产力杀手。

Spring Boot 是 Spring 社区较新的一个项目。该项目的目的是帮助开发者更容易的创建  Spring 的应用程序和服务,让更多人的人更快的对 Spring 进行入门体验,为 Spring 生态系统提供了一种固定的、约定优于配置风格的框架。

1.2、Spring Boot的特点

1、为基于 Spring 的开发提供更快的入门体验。

2、开箱即用,没有代码生成,也无需 XML 配置。同时也可以修改默认值来满足特定的需求。

3、提供了一些大型项目中常见的非功能性特性,如嵌入式服务器、安全、指标、健康检测、外部配置等。

4、Spring Boot 并不是不对 Spring 功能上的增强,而是提供了一种快速使用 Spring 的方式。

2、Spring Boot快速入门

2.1、起步依赖

创建 Maven 工程 springboot_demo 打包方式是jar即可

<packaging>jar</packaging>

在 pom.xml 中添加如下依赖

 <!--继承springboot父类依赖-->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-parent</artifactId>
   <version>2.3.7.RELEASE</version>
</parent>
<dependencies>
  <!--springboot-web启动包-->
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
  </dependency>
</dependencies>

可以点击右侧边栏中的Maven,可以看到springboot-web的启动jar包中有很多其他jar包。因为这些 jar 包被我们刚才引入的 spring-boot-starter-web 所引用了,所以我们引用 spring-boot-starter-web 后会自动把依赖传 递过来。 其中就是因为这个jar包帮我们来集成了很多配置

2.2、创建启动类

在src/main下java包中cn.itssl下创建一个SpringbootApplication启动类,这个类名可以随便起,我是为了区分@SpringBootApplication注解才起为SpringbootApplication。

@SpringBootApplication
public class SpringbootApplication {
    public static void main(String[] args) {
        //调用框架中的SpringApplication的run方法
        SpringApplication.run(SpringbootApplication.class);
    }
}

2.3、测试启动类

点击启动类的绿色箭头启动

可以看到一个spring的logo和一些日志信息, 当看到有耗时多少毫秒启动完成就代表成功运行了,可以看出springboot的入门是非常简单的,完全不需要过于繁琐的配置文件等一系列操作。

2.4、自定义banner

下面给大家介绍一个好玩的东西,就是可以随便修改启动时的spring的logo

这个网站里有各种各样的ASCII艺术图,可以拷贝或者下载

网址如下:

Ascii艺术字实现个性化Spring Boot启动banner图案,轻松修改更换banner.txt文件内容,收集了丰富的banner艺术字和图,并且支持中文banner下载,让你的banner好玩儿更有意思。-bootschool.net收集了各种有意思的Banner,如卡通、美女、永不宕机佛祖Banner等https://www.bootschool.net/ascii-art;bsid=785BFCC6B78E54E836DEECF9114151A4 在resources包下创建一个文件为banner.txt,注意:这个文件名是固定的,必须为banner.txt。

把上面的复制到banner.txt保存,重新运行启动类 

2.5、自动配置原理

Spring Boot的核心依赖是spring-boot-dependencies

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-dependencies</artifactId>
  <version>2.3.7.RELEASE</version>
  <type>pom</type>
  <scope>import</scope>
</dependency>

我们可以点开它,看看依赖的底层实现,发现全是各种依赖和版本以及插件,这里面把程序员可能用到的依赖全部整合到了这里。

2.6、启动类注解 

@SpringBootConfiguration
    |-- @Configuration    spring的配置类
        |-- @Component    spring扫描bean的组件
        
@EnableAutoConfiguration  根据依赖来自动配置
    |-- @AutoConfigurationPackage 自动配置包
    |-- @Import(AutoConfigurationImportSelector.class)  导入选择器,收集和注册特定场景相关的bean定义
    
@ComponentScan 告诉 Spring 哪个 packages 的用注解标识的类 会被 spring 自动扫描并 且装入 bean 容器。
               其实做的事情就是告诉Spring从哪里找到bean

3、Spring Boot整合SpringMVC

3.1、Controller类

我们现在开始使用 spring MVC 框架,实现 json 数据的输出。如果按照我们原来的做法,需 要在 web.xml 中添加一个 DispatcherServlet 的配置,再添加一个 spring 的配置文件,配置文件中需要添加如下配置

但是我们用 Spring Boot,这一切都省了。我们直接写 Controller 类

@RestController
public class BootWeb {

    @RequestMapping("hello")
    public String test(){
        return "hello world";
    }
}

运行启动类,直接访问路径 

3.2、注意事项

包的结构:主程序所在的包及其下面的所有子包里面的组件都会默认扫描进来

要求启动类必须大于等于当前包及其子包,如下即可

3.3、热部署

我们在开发中反复修改类、页面等资源,每次修改后都是需要重新启动才生效,这样每次启动都很麻烦,浪费了大量的时间,能不能在我修改代码后不重启就能生效呢?可以,在 pom.xml 中添加如下配置就可以实现这样的功能,我们称之为热部署。

<!--热部署-->
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <optional>true</optional>
</dependency>

使用组合键 ctrl + shift + alt +/ 搜索 Registry

3.4、application.properties配置文件

在 src/main/resources 下创建 application.propertie

#配置springboot端口
server.port=8080

#配置项目的访问路径
server.servlet.context-path=/

3.5、application.yml配置文件

yaml是一种直观的能够被计算机识别的数据序列化格式, 容易被人类阅读,yaml类似于xml,但语法更简洁;它是一种冒号,空格,换行的数据格式,对大小写第三,不允许tab只允许空格,字符串无需添加引号。YAML 的配置文件后缀为 .yml

语法:

  • 大小写敏感

  • 使用缩进表示层级关系

  • 缩进不允许使用tab,只允许空格

  • 缩进的空格数不重要,只要相同层级的元素左对齐即可

  • '#'表示注释

#配置端口和项目访问路径
server:
  port: 8082
  servlet:
    context-path: /

注意事项:如果两个application.properties和application.yml同时存在,优先加载application.properties,properties的配置文件优先级要高于yml。实际开发两种方式均可,根据自己习惯。

3.6、多环境配置文件

今后我们在开发过程中有很多种开发环境那么可能就有很多个环境的配置文件。那么如何进行配置呢?

创建多个yml文件,分别给dev、online、test分配8081、8082、8083端口号,避免重复

server:
  port: 8080
  servlet:
    context-path: /
spring:
  application:
    name: springbootdemo

  #在主配置application.yml文件中把其他的配置文件进行激活
 
  devtools:
    restart:
      additional-paths: src/main/java
  #激活开发环境 , 相当于引入application-dev.yml环境
  profiles:
    active:  dev

可以发现,启动时端口号就被该为了8081端口,只要active激活那个配置文件,就以那个环境的端口号启动。如果激活环境与当前环境相同,走激活环境。

3.7、Spring Boot访问jsp

添加依赖

因为SpringBoot不支持jsp,必须手动去添加

<!-- servlet,jsp -->
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat-jsp-api</artifactId>
    <scope>provided</scope>
</dependency>
<!--tomcat支持-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>

jsp页面只能在src/main/webapp下访问,在WEB-INF下创建一个views包,新建一个hello.jsp页面 

在yml配置文件中配置视图解析器,添加前缀后缀

#views
spring:
  mvc:
    view:
      prefix: /WEB-INF/views/
      suffix: .jsp

Controller类进行测试 

@Controller
public class JspController {
	
	@RequestMapping("/index")
	public String index(HttpServletResponse response, HttpServletRequest request ){
		
		request.setAttribute("msg", "这是springboot集成jsp");
		
		// return "index";//访问的是视图解析器的jsp
		// return "forward:/hello.jsp";//访问的是外部的jsp
     	return "redirect:/hello.jsp";
		
	}
}

如果编译不了或者找不到jsp的,解决方案如下,在pom.xml中添加bulid

<!--编译webapp下的jsp文件-->
<build>
       <resource>
           <directory>src/main/webapp</directory>
           <targetPath>META-INF/resources</targetPath>
           <includes>
               <include>**/*.*</include>
           </includes>
       </resource>
   </resources>
</build>

4、快速构建Spring Initializr

4.1、方式一:官方模版

选择第一个官方默认模版,下一步,可能会比较慢,如果实在加载不出来就使用方式二阿里云的模版,因为阿里云是国内的,相对来说会快很多。

finish就创建完毕了

4.2、方式二:阿里云模版

把下面的地址填写到框里

https://start.aliyun.com

以下步骤和官方的一致,我这里不再演示。

5、Spring Boot使用Thymeleaf

创建Spring Boot项目,选择模版,如下图所示,会自动配置整合。

5.1、Thymeleaf概述

Thymeleaf官网 Thymeleaf

Spring Boot官方招推荐Thymeleaf作为视图的显示技术。

Thymeleaf 在有网络和无网络的环境下皆可运行,即它可以让美工在浏览器查看页面的静态效果,也可以让程序员在服务器查看带数据的动态页面效果。这是由于它支持 html 原型,然后在 html 标签里增加额外的属性来达到模板+数据的展示方式。浏览器解释 html 时会忽略未定义的标签属性,所以 thymeleaf 的模板可以静态地运行;当有数据返回到页面时,Thymeleaf 标签会动态地替换掉静态内容,使页面动态显示。

Thymeleaf 开箱即用的特性。它提供标准和spring标准两种方言,可以直接套用模板实现JSTL、 OGNL表达式效果,避免每天套模板、改jstl、改标签的困扰。同时开发人员也可以扩展和创建自定义的方言。

thymeleaf的实现机制相较于其他模板引擎更加的优雅。由于各种绑定与控制采用属性的方式,可以使得模板不破坏html原有的语法结构。

Thymeleaf模板文件后缀名就是.html, 制作完成后,我们可以直接打开浏览效果。

5.2、添加依赖

<!-- thymeleaf模板依赖 -->
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

5.3、thymeleaf模版配置

#thymeleaf模板配置
# THYMELEAF (ThymeleafAutoConfiguration)
# 在构建 URL 时添加到视图名称前的前缀(默认值: classpath:/templates/ )
spring.thymeleaf.prefix=classpath:/templates/
# 在构建 URL 时添加到视图名称后的后缀(默认值: .html )
spring.thymeleaf.suffix=.html
# 要运⽤于模板之上的模板模式。另⻅ StandardTemplate-ModeHandlers( 默认值: HTML5)
spring.thymeleaf.mode=HTML5
# 模板编码
spring.thymeleaf.encoding=UTF-8
#Content-Type 的值(默认值: text/html )
spring.thymeleaf.content-type=text/html
# 开启模板缓存(默认值: true )
spring.thymeleaf.cache=true
# 开启 MVC Thymeleaf 视图解析(默认值: true )
spring.thymeleaf.enabled=true
# 检查模板是否存在,然后再呈现
spring.thymeleaf.check-template=true
# 检查模板位置是否正确(默认值 :true )
spring.thymeleaf.check-template-location=true

5.4、变量

Controller类

@Controller
@RequestMapping("test")
public class Test1 {

    @RequestMapping("demo1")
    public String demo1(Model model){
        model.addAttribute("name","zhangsan");
        return "main";
    }
}

html页面

<!--引入thymeleaf,避免编辑器校验出现的错误,并非必须的,不引入也是正常运行的  -->
<html xmlns:th = "http://www.thymeleaf.org">
    
<span th:text="${name}"></span>

5.5、对象变量

@Data
public class User {
    private Integer id;
    private String username;
    private String password;
    private String nickname;

}
    @RequestMapping("demo2")
    public String demo2(Model model){
        User user = new User();
        user.setId(11);
        user.setUsername("zhangsan");
        user.setNickname("张三");
        user.setPassword("asd123");
        model.addAttribute("user",user);
        return "main";
    }
    <html xmlns:th = "http://www.thymeleaf.org">
    <body>
    id: <span th:text="${user.id}"></span>
    name: <span th:text="${user.username}"></span>
    nickname: <span th:text="${user.nickname}"></span>
    nickname: <span th:text="${user.nickname}"></span>
    </body>

5.6、集合变量

	@RequestMapping("demo3")
    public String demo3(Model model){
        User user = new User();
        user.setId(11);
        user.setUsername("zhangsan");
        user.setNickname("张三");
        user.setPassword("asd123");

        User user2 = new User();
        user2.setId(22);
        user2.setUsername("lisi");
        user2.setNickname("李四");
        user2.setPassword("asd321");

        List<User> list = new ArrayList<>();
        list.add(user);
        list.add(user2);

        model.addAttribute("list",list);
        return "main";
    }
<html lang="en">
<html xmlns:th = "http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1px" cellpadding="1px" cellspacing="0px">
    <tr>
        <th>序号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>昵称</th>
    </tr>
    <tr th:each="user:${list}">
        <td th:text="${user.id}"></td>
        <td th:text="${user.username}"></td>
        <td th:text="${user.password}"></td>
        <td th:text="${user.nickname}"></td>
    </tr>
</table>
</body>
</html>

5.7、获取value值

    @RequestMapping("demo7")
    public String demo7(Model model){

        User user = new User();
        user.setUsername("liming");
        user.setNickname("李明");

        model.addAttribute("user",user);
        return "main";
    }
   <form action="#" method="post">
        <input type="text" name="username" th:value="${user.username}">
        <input type="text" name="nickname" th:value="${user.nickname}">
        <input type="submit">
    </form>

5.8、获取session值

@RequestMapping("demo5")
public String demo5(HttpSession session , HttpServletRequest request){
    session.setAttribute("str","zhangsan");
    request.setAttribute("sex","男");
    return "main";
}
    <!--这里的${}并不是el表达式-->
    <span th:text="${session.str}"></span>
    <span th:text="${#session.getAttribute('str')}"></span>

    <!--<span th:text="${request.sex}"></span> 这种获取不了-->
    <span th:text="${#request.getAttribute('sex')}"></span>

5.9、if判断

    @RequestMapping("demo4")
    public String demo4(Model model){
        User user = new User();
        user.setUsername("a");

        model.addAttribute("user",user);
        return "main";
    }
<span th:if="${user.username eq 'a'}">登录成功</span>
<span th:if="${user.username eq 'b'}">登录失败</span>

5.10、引入连接

    //通过把控制器访问
	@RequestMapping("demo6")
    public String demo6(){
        return "main";
    }
div{
    width: 120px;
    height: 120px;
    background-color: cyan;
}
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    
    <!--th:href="@{/css/101.css} 引入连接-->
    <link rel="stylesheet" type="text/css" media="all" th:href="@{/css/101.css}" />
</head>
<body>

    <div></div>

</body>

6、Spring Boot整合Mybatis

6.1、搭建工程

使用官方默认路径也可,这里我使用阿里云地址,网速会快些,同时也是支持中文的。

选择Mybatis框架模板

选择好模板后,pom.xml文件Spring Boot会自动为我们导入依赖,并且properties文件也会给我们整合好相关配置。只需要我们稍作修改即可

# 应用名称
spring.application.name=springboot_mybatis
# 应用服务 WEB 访问端口
server.port=8080
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
mybatis.mapper-locations=classpath:mappers/*xml
#指定Mybatis的实体目录
mybatis.type-aliases-package=com.itssl.springboot_mybatis.pojo
# 数据库驱动:
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# 数据源名称
spring.datasource.name=defaultDataSource
# 数据库连接地址
spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=true
# 数据库用户名&密码:
spring.datasource.username=root
spring.datasource.password=xxx
# THYMELEAF (ThymeleafAutoConfiguration)
# 开启模板缓存(默认值: true )
spring.thymeleaf.cache=true
# 检查模板是否存在,然后再呈现
spring.thymeleaf.check-template=true
# 检查模板位置是否正确(默认值 :true )
spring.thymeleaf.check-template-location=true
#Content-Type 的值(默认值: text/html )
spring.thymeleaf.content-type=text/html
# 开启 MVC Thymeleaf 视图解析(默认值: true )
spring.thymeleaf.enabled=true
# 模板编码
spring.thymeleaf.encoding=UTF-8
# 要被排除在解析之外的视图名称列表,⽤逗号分隔
spring.thymeleaf.excluded-view-names=
# 要运⽤于模板之上的模板模式。另⻅ StandardTemplate-ModeHandlers( 默认值: HTML5)
spring.thymeleaf.mode=HTML5
# 在构建 URL 时添加到视图名称前的前缀(默认值: classpath:/templates/ )
spring.thymeleaf.prefix=classpath:/templates/
# 在构建 URL 时添加到视图名称后的后缀(默认值: .html )
spring.thymeleaf.suffix=.html

6.2、数据库准备

CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(25) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `nickname` varchar(25) DEFAULT NULL,
  `createdtime` datetime DEFAULT NULL,
  `updatedtime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

6.3、实体类

@Data
public class User {
    private Integer id;
    private String username;
    private String password;
    private String nickname;
}

6.4、controller层

@Controller
@Slf4j
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("queryAllUser")
    public String queryAllUser(Model model) {
        List<User> users = userService.queryAll();
        model.addAttribute("list", users);
        return "list";
    }

}

6.5、service层

public interface UserService {
    List<User> queryAll();
}
@Service
public class UserServiceImpl  implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> queryAll() {
      return   userMapper.queryAll();
    }
}

6.6、mapper层

public interface UserMapper {
    public List<User> queryAll();
}

6.7、UserMapper.xml映射文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.itssl.springboot_mybatis.mapper.UserMapper">
       <select id="queryAll" resultType="User">
           select * from user
       </select>
</mapper>

6.8、启动类

@SpringBootApplication
@MapperScan("com.itssl.springboot_mybatis.mapper") //扫描mapper接口
public class SpringbootMybatisApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootMybatisApplication.class, args);
    }

}

6.9、页面 

注意:list页面要放到templates包下,使用的是thyTemplate模版

<html lang="en">
<html xmlns:th = "http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1px" cellpadding="1px" cellspacing="0px">
    <tr>
        <th>序号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>出生年份</th>
    </tr>
    <tr th:each="user:${list}">
        <td th:text="${user.id}"></td>
        <td th:text="${user.username}"></td>
        <td th:text="${user.password}"></td>
        <td th:text="${user.nickname}"></td>
    </tr>
</table>
</body>
</html>

6.10、测试

6.11、使用ajax请求

将该页面放到static包下

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2 style="text-align: center">用户显示</h2></span>
<table align="center" border="1" cellpadding="8px" cellspacing="0px" width="70%" id="table">
    <tr>
        <td>id</td>
        <td>username</td>
        <td>password</td>
        <td>nickname</td>
    </tr>
</table>
</body>
<script src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
    $.ajax({
        type: "get",
        url: "/user/queryAllUserAjax",
        success: function (data) {
            var str = '';
            $(data).each(function (index, user) {
                str += `
               <tr>
                  <td>${user.id}</td>
                  <td>${user.username}</td>
                  <td>${user.password}</td>
                  <td>${user.nickname}</td>
               </tr>
               `;
            });
            $("#table").append(str);
        }


    })
</script>
</html>

 controller层

@Controller
@Slf4j
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("queryAllUser")
    public String queryAllUser(Model model) {
        List<User> users = userService.queryAll();
        model.addAttribute("list", users);
        return "list";
    }

    @RequestMapping("queryAllUserAjax")
    @ResponseBody
    public List<User> queryAllUserAjax() {
        log.info("查询所有操作运行");
        return userService.queryAll();
    }
}

测试

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值