一、简介
    Restful是一种对url进行规范的编码风格,通常一个网址对应一个资源,访问形式类似http://xxx.com/xx/{id}/{id}。

举个栗子,当我们在某购物网站上买手机时会有很多品牌选择,而每种品牌下又有很多型号,那么https://mall.com/mobile/iphone/6 代表了Iphone6,https://mall.com/mobile/iphone/7和https://mall.com/mobile/iphone/8分别代表了Iphone7和Iphone8。

SpringBoot内置了SpringMvc中,也提供了@RequestParam, @RequestBody和@PathVariable 三个注解获取客户端参数,其中前两者获取的是客户端post提交的参数,而@PathVariable 则是从访问url中获取参数。
    言归正传,下面我们以用户管理系统为例,在SpringBoot中编写一组Restful风格的接口吧。

二、开发环境

  • IDE:IntelliJ IDEA
  • 官网地址:https://www.jetbrains.com/idea/download/
  • JDK:1.8
  • 数据库:MySQL
  • 构建工具:Maven

三、编写自己的Restful程序

1.创建SpringBoot项目,如下图所示:

点击Next,选择一些基本项目参数,如下图:

点击Next,选择我们需要的组件,这里我们选择MySQL,JPA,WEB组件作为我们开发组件。如下图所示:

点击Finish即完成项目的创建,项目结构如下图:

2.项目依赖Maven配置pom.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.forMelo</groupId>
<artifactId>myrestfulproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging> <name>myrestfulproject</name>
<description>Demo project for Spring Boot</description> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> </project>

3.数据源、JPA配置

SpringBoot默认配置文件为application.properties,我们将其修改为application.yml格式,.yml属性文件层次感和可读性更强。application.yml具体配置如下:

spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8
driverClassName: com.mysql.jdbc.Driver
username: root
password: 1
jpa:
database: MySQL
show-sql: true
hibernate:
ddl-auto: update
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy

下面我们在mysql中创建test数据库,使用SQLyog创建表t_user_info,如下图所示:

4.编写控制器UserController.java和实体类User.java

UserController.java

package com.formelo.controller;

import com.formelo.entity.User;
import com.formelo.repository.UserJPARepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import java.util.List; /**
* Created by songqiuming on 2018/1/7.
*/
@RestController
public class UserController { @Autowired
private UserJPARepository userJPARepository; /**
* 查询用户列表
* @return
*/
@GetMapping(value = "/user")
public List<User> findUserList(){
return userJPARepository.findAll();
} /**
* 根据Id查询一个用户
* @param id
* @return
*/
@GetMapping(value = "/user/query/{id}")
public User findUserOne(@PathVariable("id") Integer id){
return userJPARepository.findOne(id);
} /**
* 添加用户
* @param name
* @param age
* @param country
* @return
*/ @PostMapping(value = "/user")
public User addUser(@RequestParam("name") String name, @RequestParam("age") int age,
@RequestParam("country") String country){
User user = new User();
user.setName(name);
user.setAge(age);
user.setCountry(country);
return userJPARepository.save(user);
} /**
* 删除用户
* @param id 用户编号
* @return
*/
@DeleteMapping(value = "/user/{id}")
public List<User> deleteUser(@PathVariable("id") Integer id){
userJPARepository.delete(id);
return userJPARepository.findAll();
} /**
* 更新用户
* @param id
* @param name
* @param age
* @param country
* @return
*/
@PutMapping(value = "/user/{id}")
public User updateUser(@PathVariable("id") Integer id, @RequestParam("name") String name,
@RequestParam("age") int age, @RequestParam("country") String country){
User user = userJPARepository.findById(id);
user.setName(name);
user.setAge(age);
user.setCountry(country);
return userJPARepository.save(user);
} /**
* 根据国家查询用户
* @param country
* @return
*/
@GetMapping(value = "/user/{country}")
public List<User> findByCountry(@PathVariable("country") String country){
return userJPARepository.findByCountry(country);
} }

User.java

package com.formelo.entity;

import javax.persistence.*;

/**
* Created by songqiuming on 2018/1/7.
*/
@Entity
@Table(name = "t_user_info")
public class User { private static final long serialVersionUID = -3039703447657705408L; @Id
@GeneratedValue
@Column(name = "id")
private Long id;
@Column(name = "name")
private String name;
@Column(name="age")
private int age;
@Column(name="country")
private String country; public User() {
} public Long getId() {
return id;
} public void setId(Long id) {
this.id = id;
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public int getAge() {
return age;
} public void setAge(int age) {
this.age = age;
} public String getCountry() {
return country;
} public void setCountry(String country) {
this.country = country;
} @Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", age=" + age +
", country='" + country + '\'' +
'}';
}
}

5.创建JPA

创建UserJPARepository.java,它继承SpringDataJPA内的JpaRepository接口,实现与数据库的交互。

UserJPARepository.java

package com.formelo.repository;

import com.formelo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; /**
* Created by songqiuming on 2018/1/7.
*/
public interface UserJPARepository extends JpaRepository<User,Long> {
User findById(Long id);
List<User> findByCountry(String country);
}

6.启动项目

到处为止,我们已经完成一组restful风格接口的编码,运行MyrestfulprojectApplication的main方法,启动项目,控制台输出:

"C:\Program Files\Java\jdk1.8.0_102\bin\java" ...
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.9.RELEASE) 2018-01-09 21:57:41.533 INFO 6884 --- [ main] com.formelo.MyrestfulprojectApplication : Starting MyrestfulprojectApplication on DESKTOP-6SJA93T with PID 6884 (D:\myproject\myrestfulproject\target\classes started by songqiuming in D:\myproject\myrestfulproject)
2018-01-09 21:57:41.560 INFO 6884 --- [ main] com.formelo.MyrestfulprojectApplication : No active profile set, falling back to default profiles: default
2018-01-09 21:57:41.763 INFO 6884 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@65466a6a: startup date [Tue Jan 09 21:57:41 CST 2018]; root of context hierarchy
2018-01-09 21:57:47.897 INFO 6884 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-01-09 21:57:47.969 INFO 6884 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-01-09 21:57:47.972 INFO 6884 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23
2018-01-09 21:57:48.358 INFO 6884 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-01-09 21:57:48.359 INFO 6884 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 6609 ms
2018-01-09 21:57:48.663 INFO 6884 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-01-09 21:57:48.669 INFO 6884 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-01-09 21:57:48.670 INFO 6884 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-01-09 21:57:48.670 INFO 6884 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-01-09 21:57:48.670 INFO 6884 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-01-09 21:57:49.598 INFO 6884 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-01-09 21:57:49.656 INFO 6884 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-01-09 21:57:49.817 INFO 6884 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2018-01-09 21:57:49.819 INFO 6884 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-01-09 21:57:49.820 INFO 6884 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2018-01-09 21:57:49.976 INFO 6884 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Tue Jan 09 21:57:50 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:50 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:50 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:50 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:50 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:51 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:51 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:51 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:51 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jan 09 21:57:51 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2018-01-09 21:57:51.225 INFO 6884 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2018-01-09 21:57:52.092 INFO 6884 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2018-01-09 21:57:52.229 INFO 6884 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-01-09 21:57:53.483 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@65466a6a: startup date [Tue Jan 09 21:57:41 CST 2018]; root of context hierarchy
2018-01-09 21:57:53.666 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user],methods=[POST]}" onto public com.formelo.entity.User com.formelo.controller.UserController.addUser(java.lang.String,int,java.lang.String)
2018-01-09 21:57:53.667 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user/{country}],methods=[GET]}" onto public java.util.List<com.formelo.entity.User> com.formelo.controller.UserController.findByCountry(java.lang.String)
2018-01-09 21:57:53.669 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user/{id}],methods=[DELETE]}" onto public java.util.List<com.formelo.entity.User> com.formelo.controller.UserController.deleteUser(java.lang.Long)
2018-01-09 21:57:53.669 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user/{id}],methods=[GET]}" onto public com.formelo.entity.User com.formelo.controller.UserController.findUserOne(java.lang.Long)
2018-01-09 21:57:53.670 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user/{id}],methods=[PUT]}" onto public com.formelo.entity.User com.formelo.controller.UserController.updateUser(java.lang.Long,java.lang.String,int,java.lang.String)
2018-01-09 21:57:53.670 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/user],methods=[GET]}" onto public java.util.List<com.formelo.entity.User> com.formelo.controller.UserController.findUserList()
2018-01-09 21:57:53.673 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-01-09 21:57:53.674 INFO 6884 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-01-09 21:57:53.761 INFO 6884 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-09 21:57:53.762 INFO 6884 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-09 21:57:53.945 INFO 6884 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-09 21:57:54.419 INFO 6884 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-01-09 21:57:54.520 INFO 6884 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-01-09 21:57:54.525 INFO 6884 --- [ main] com.formelo.MyrestfulprojectApplication : Started MyrestfulprojectApplication in 14.573 seconds (JVM running for 16.939)

7.接口测试

下面我们打开postman测试接口。首先,往数据库里插入几条数据,对应的请求如下:

  • 查询用户列表

根据ID查询一个用户:

添加用户:

更新用户:

使用SpringBoot编写Restful风格接口的更多相关文章

  1. SpringBoot2.0基础案例(01):环境搭建和RestFul风格接口

    一.SpringBoot 框架的特点 1.SpringBoot2.0 特点 1)SpringBoot继承了Spring优秀的基因,上手难度小 2)简化配置,提供各种默认配置来简化项目配置 3)内嵌式容 ...

  2. SpringBoot之RESTful风格

    SpringBoot之RESTful风格 1.RESTful介绍 RESTful是一种软件架构风格,一种时尚! RESTful架构风格规定,数据的元操作,即CRUD(create, read, upd ...

  3. 『政善治』Postman工具 — 3、补充:restful风格接口的项目说明

    目录 (一)RESTful架构风格特点 1.统一接口风格 2.规范的HTTP请求方法 3.HTTP响应码 4.什么是无状态 (二)JSON数据格式说明 1.什么是JSON 2.JSON格式的特点 3. ...

  4. java框架之SpringBoot(6)-Restful风格的CRUD示例

    准备 环境 IDE:Idea SpringBoot版本:1.5.19 UI:BootStrap 4 模板引擎:thymeleaf 3 效果:Restful 风格 CRUD 功能的 Demo 依赖 &l ...

  5. restful风格接口和spring的运用

    Restful风格的API是一种软件架构风格,设计风格而不是标准,只是提供了一组设计原则和约束条件.它主要用于客户端和服务器交互类的软件.基于这个风格设计的软件可以更简洁,更有层次,更易于实现缓存等机 ...

  6. 用Node编写RESTful API接口

    前言 本文将通过一个todo list前后端分离的小项目来讲解如何用Node创建符合RESTful风格的API接口. 创建HTTP服务器 我们先来了解下如何用Node创建HTTP服务器(熟悉的读者可以 ...

  7. 第一节:WebApi的纯原生态的RestFul风格接口和路由规则介绍

    一. 原生态接口 1. 从默认路由开始分析 在WebApiConfig.cs类中的Register方法中,我们可以看到默认路由如下: 分析:请求地址在 controller 前面需要加上 api/,c ...

  8. thinkphp5.0极速搭建restful风格接口层实例

    作为国内最流行的php框架thinkphp,很快就会发布v5.0正式版了,现在还是rc4版本,但已经很强大了下面是基于ThinkPHP V5.0 RC4框架,以restful风格完成的新闻查询(get ...

  9. Restful风格接口浅析

    为什么使用RESTful1.JSP技术可以让我们在页面中嵌入Java代码,但是这样的技术实际上限制了我们的开发效率,因为需要我们Java工程师将html转换为jsp页面,并写一些脚本代码,或者前端代码 ...

随机推荐

  1. [LeetCode] 145. Binary Tree Postorder Traversal 二叉树的后序遍历

    Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary ...

  2. Js apply方法与call方法详解 附ES6新写法

    我在一开始看到javascript的函数apply和call时,非常的模糊,看也看不懂,最近在网上看到一些文章对apply方法和call的一些示例,总算是看的有点眉目了,在这里我做如下笔记,希望和大家 ...

  3. fiddler抓包-1-安装与快速上手

    前言 fiddler作为一个中间商协议代理,众所周知,有请求就会有响应,那没有响应呢?那就是哪个环节出现问题了.通过代理就可以查看到所有请求信息.与响应信息.举个例子,以前上学时有没有写过情书?或者给 ...

  4. Unity C# File类 本地数据保存和游戏存档

    进行本地数据存档和载入在游戏开发中非常常见,几乎任何一款游戏都需要这样的功能. 命名空间: using System.IO; 主要用于引入File类以处理各类文件操作. using System.Ru ...

  5. 使用excel中的数据快速生成sql语句

    在小公司的话,总是会有要开发去导入历史数据(数据从旧系统迁移到新系统上)的时候.这个时候,现场实施或客户会给你一份EXCEL文档,里面包含了一些别的系统上的历史数据,然后就让你导入到现在的系统上面去. ...

  6. 你知道Object中有哪些方法及其作用吗?

    一.引言二.Object方法详解1.1.registerNatives()1.2.getClass()1.2.1.反射三种方式:1.3.hashCode()1.4.equals()1.4.clone( ...

  7. 用pyenv管理Python多版本及下载加速方法--Mac上

    原文:https://www.jianshu.com/p/91fc7ecc5e46 先大致介绍下pyenv的安装及配置流程.随后介绍加速下载方法 安装: brew install pyenv 配置 在 ...

  8. 一、hexo+github搭建个人博客的过程记录

    前提: 1.新建一个github仓库 2.安装配置Node.js 3.安装配置Git 前提 步骤1.新建一个github仓库 打开github网站,(注册)登录账号,新建一个仓库; 注:==仓库名称要 ...

  9. 『Norma 分治』

    Norma Description Input Format 第1行,一个整数N: 第2~n+1行,每行一个整数表示序列a. Output Format 输出答案对10^9取模后的结果. Sample ...

  10. SpringBoot+Mybatis+Druid批量更新 multi-statement not allow异常

      本文链接:https://blog.csdn.net/weixin_43947588/article/details/90109325 注:该文是本博主记录学习之用,没有太多详细的讲解,敬请谅解! ...