Springboot拦截器如何获取@RequestBody参数

Springboot拦截器获取@RequestBody参数

HttpContextUtils

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
 * HttpContextUtils
 *
 * @author itdragons
 */
public class HttpContextUtils {

	/**
	 * 获取query参数
	 * @param request
	 * @return
	 */
	public static Map<String, String> getParameterMapAll(HttpServletRequest request) {
		Enumeration<String> parameters = request.getParameterNames();
		Map<String, String> params = new HashMap<>();
		while (parameters.hasMoreElements()) {
			String parameter = parameters.nextElement();
			String value = request.getParameter(parameter);
			params.put(parameter, value);
		}
		return params;
	}
	/**
	 * 获取请求Body
	 *
	 * @param request
	 * @return
	 */
	public static String getBodyString(ServletRequest request) {
		StringBuilder sb = new StringBuilder();
		InputStream inputStream = null;
		BufferedReader reader = null;
		try {
			inputStream = request.getInputStream();
			reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
			String line = "";
			while ((line = reader.readLine()) != null) {
				sb.append(line);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (inputStream != null) {
				try {
					inputStream.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return sb.toString();
	}
}

request.getInputStream()只能读取一次,所以当使用拦截器时,controller已经不能获取body中的参数。所以需要增加一个过滤器来解决,使流可以重复读取。代码如下

HttpServletRequest 过滤器:流可重复读

import com.xm.common.utils.HttpContextUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
/***
 * HttpServletRequest 过滤器
 * 解决: request.getInputStream()只能读取一次的问题
 * 目标: 流可重复读
 */
@Component
@WebFilter(filterName = "HttpServletRequestFilter", urlPatterns = "/")
@Order(10000)
public class HttpServletRequestFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        ServletRequest requestWrapper = null;
        if(servletRequest instanceof HttpServletRequest) {
            requestWrapper = new RequestWrapper((HttpServletRequest) servletRequest);
        }
        //获取请求中的流如何,将取出来的字符串,再次转换成流,然后把它放入到新request对象中
        // 在chain.doFiler方法中传递新的request对象
        if(null == requestWrapper) {
            filterChain.doFilter(servletRequest, servletResponse);
        } else {
            filterChain.doFilter(requestWrapper, servletResponse);
        }
    }
    @Override
    public void destroy() {
    }
    /***
     * HttpServletRequest 包装器
     * 解决: request.getInputStream()只能读取一次的问题
     * 目标: 流可重复读
     */
    public class RequestWrapper extends HttpServletRequestWrapper {
        /**
         * 请求体
         */
        private String mBody;
        public RequestWrapper(HttpServletRequest request) {
            super(request);
            // 将body数据存储起来
            mBody = getBody(request);
        }
        /**
         * 获取请求体
         * @param request 请求
         * @return 请求体
         */
        private String getBody(HttpServletRequest request) {
            return HttpContextUtils.getBodyString(request);
        }
        /**
         * 获取请求体
         * @return 请求体
         */
        public String getBody() {
            return mBody;
        }
        @Override
        public BufferedReader getReader() throws IOException {
            return new BufferedReader(new InputStreamReader(getInputStream()));
        }
        @Override
        public ServletInputStream getInputStream() throws IOException {
            // 创建字节数组输入流
            final ByteArrayInputStream bais = new ByteArrayInputStream(mBody.getBytes(StandardCharsets.UTF_8));
            return new ServletInputStream() {
                @Override
                public boolean isFinished() {
                    return false;
                }
                @Override
                public boolean isReady() {
                    return false;
                }
                @Override
                public void setReadListener(ReadListener readListener) {
                }
                @Override
                public int read() throws IOException {
                    return bais.read();
                }
            };
        }
    }
}

Springboot下WebRequest获取RequestBody参数

背景:

因为RequestBody是以流的形式读取,流读取一次以后就没有了,所以HttpServletRequest 的 getInputStream() 和 getReader() 都只能读取一次。

如果想要通过WebRequst再次获取RequestBody中的参数,首先需将RequestBody保存,然后通过自定义HttpServletRequestWrapper类,重写当中getReader()和getInputStream()方法;然后再通过Filter中将ServletRequest替换为自定的HttpServletRequestWrapper

一、自定义HttpServletRequestWrapper类

1. CustomizeHttpServletRequestWrapper.java

package com.zsx.http;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.*;

@Slf4j
public class CustomizeHttpServletRequestWrapper extends HttpServletRequestWrapper {
    private byte[] buffer = {};

    /**
     * Constructs a request object wrapping the given request.
     *
     * @param request The request to wrap
     * @throws IllegalArgumentException if the request is null
     */
    public CustomizeHttpServletRequestWrapper(HttpServletRequest request) {
        super(request);
        log.info("=========CustomizeHttpServletRequestWrapper.CustomizeHttpServletRequestWrapper()=========");
        try {
            InputStream is = request.getInputStream();
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            byte[] buff = new byte[1024];
            int read = 0;
            while ((read = is.read(buff)) > 0) {
                os.write(buff, 0, read);
                this.buffer = os.toByteArray();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public ServletInputStream getInputStream() {
        log.info("=========CustomizeHttpServletRequestWrapper.getInputStream()=========");
        final ByteArrayInputStream is = new ByteArrayInputStream(buffer);
        return new ServletInputStream() {

            @Override
            public int read() {
                return is.read();
            }

            @Override
            public boolean isFinished() {
                return is.available() == 0;
            }

            @Override
            public boolean isReady() {
                return true;
            }

            @Override
            public void setReadListener(ReadListener readListener) {
                //do nothing
            }
        };
    }

    @Override
    public BufferedReader getReader() {
        log.info("=========CustomizeHttpServletRequestWrapper.getReader()=========");
        return new BufferedReader(new InputStreamReader(this.getInputStream()));
    }
}

二、定义过滤器

1. RequestBodyParameterReadingFilter.java

package com.zsx.filter;
import com.zsx.http.CustomizeHttpServletRequestWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@Slf4j
@Configuration
public class RequestBodyParameterReadingFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("=========RequestBodyParameterReadingFilter.init()=========");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        log.info("=========RequestBodyParameterReadingFilter.doFilter()=========");
        if (request instanceof HttpServletRequest) {
            String contentType = request.getContentType();
            // 如果处理上传文件数据,下面方法执行到chain.doFilter()时会出线异常,所以此处只处理@RequestBody数据
            if (!StringUtils.isEmpty(contentType) && contentType.contains(MediaType.APPLICATION_JSON_VALUE)) {
                log.info("=========RequestBodyParameterReadingFilter.doFilter().jsonRequest=========");
                ServletRequest jsonRequest = new CustomizeHttpServletRequestWrapper((HttpServletRequest) request);
                chain.doFilter(jsonRequest, response);
                return;
            }
        }
        chain.doFilter(request, response);
    }
    @Override
    public void destroy() {
        log.info("=========RequestBodyParameterReadingFilter.destroy()=========");
    }
}

三、定义全局异常处理器

1. GlobalExceptionHandler.java

package com.zsx.exception;
import com.zsx.http.CustomizeHttpServletRequestWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.stream.Collectors;

@Slf4j
@RestControllerAdvice
@Order(Ordered.HIGHEST_PRECEDENCE)
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {

    @Override
    @SuppressWarnings("NullableProblems")
    protected ResponseEntity<Object> handleExceptionInternal(Exception ex, @Nullable Object body,
                                                             HttpHeaders headers,
                                                             HttpStatus status,
                                                             WebRequest request) {
        try {
            log.info("=========GeneralExceptionHandler.handleExceptionInternal()=========");
            HttpServletRequest req = ((ServletWebRequest) request).getRequest();
            String bodyParams = req.getReader().lines().collect(Collectors.joining());
            log.info("RequestBody Parameters : {} ", bodyParams);
        } catch (IOException e) {
            e.printStackTrace();
            log.error("GeneralExceptionHandler.handleExceptionInternal().IOException : {}", ex.getMessage());
        }
        return super.handleExceptionInternal(ex, body, headers, status, request);
    }

    @ExceptionHandler(Exception.class)
    public ResponseEntity<Object> exception(Exception ex, HttpServletRequest request) {
        log.info("=========GeneralExceptionHandler.exception()=========");
        CustomizeHttpServletRequestWrapper wrapper = new CustomizeHttpServletRequestWrapper(request);
        BufferedReader reader = wrapper.getReader();
        String bodyParams = reader.lines().collect(Collectors.joining());
        log.info("RequestBody Parameters : {} ", bodyParams);
        log.error("GeneralExceptionHandler.exception() : {}", ex.getMessage());
        return handleExceptionInternal(ex, bodyParams, HttpHeaders.EMPTY, HttpStatus.NOT_FOUND, new ServletWebRequest(request));
    }
}

四、异常控制器测试类

1. ExceptionTestController.java

package com.zsx.controller;
import com.zsx.entity.User;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/exception")
public class ExceptionTestController {

    @PostMapping(value = "/user")
    public String test(@RequestBody User user) {
        throw new RuntimeException("Test RuntimeException");
    }
}

五、启动程序,发送请求

1. http://localhost:8088/exception/user

六、查看结果

E:\jdk\jdk-14.0.1\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59350,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\18273\AppData\Local\JetBrains\IntelliJIdea2020.2\groovyHotSwap\gragent.jar -javaagent:C:\Users\18273\AppData\Local\JetBrains\IntelliJIdea2020.2\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "F:\IdeaProjects\my-jooq\out\production\classes;F:\IdeaProjects\my-jooq\out\production\resources;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.3.1.RELEASE\555c4f90141cdbc7637145e413bca0d622ba6796\spring-boot-starter-web-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\2.3.1.RELEASE\5531a4cbd506f13a0b4483ed73c2e75a03d8da46\spring-boot-starter-data-jpa-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jooq\2.3.1.RELEASE\56972c0f55ef078439045d8548c115cefaeda0f2\spring-boot-starter-jooq-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.projectlombok\lombok\1.18.12\48e4e5d60309ebd833bc528dcf77668eab3cd72c\lombok-1.18.12.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.alibaba\fastjson\1.2.73\db7da6dcbd7d97876d626aa79775711fc0dc8cd1\fastjson-1.2.73.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.postgresql\postgresql\42.2.12\1ed5b5f16a67f312a50d420e8bcb7d30b40b033d\postgresql-42.2.12.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.hynnet\json-lib\2.4\136743e0d12df4e785e62b48618cee169b2ae546\json-lib-2.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.flywaydb\flyway-core\6.4.0\a9a4101b87df144d928491220829b5e8b51d4b5f\flyway-core-6.4.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jooq\jooq-codegen\3.13.2\3321b6c25c2f16361e1435760a843d92a63a80e7\jooq-codegen-3.13.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jooq\jooq-meta\3.13.2\5fbf793257121dd922dd8b5e7bca2bdcda8e9495\jooq-meta-3.13.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-tx\5.2.5.RELEASE\29c07e0d3013ba8fcfa760b2fab457bea19d89bc\spring-tx-5.2.5.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.reflections\reflections\0.9.12\1c9d44c563eebe9b8a3afebd29ed5c4646db800c\reflections-0.9.12.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.logstash.logback\logstash-logback-encoder\6.3\79468d3566f9cf837fa3805dd2de057002d4ea04\logstash-logback-encoder-6.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.client\elasticsearch-rest-high-level-client\7.8.0\67055e932c831595575463ef652c8d8ddaae2d28\elasticsearch-rest-high-level-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.client\elasticsearch-rest-client\7.8.0\ab28f6110bdc7d2ec886e1d6ff29a6c8ee30b883\elasticsearch-rest-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch\7.8.0\e87ef417087e4edcb1955d9239fcbc07413160c5\elasticsearch-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.guava\guava\29.0-jre\801142b4c3d0f0770dd29abea50906cacfddd447\guava-29.0-jre.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.json\json\20200518\41a767de4bde8f01d53856b905c49b2db8862f13\json-20200518.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\javax.validation\validation-api\2.0.1.Final\cb855558e6271b1b32e716d24cb85c7f583ce09e\validation-api-2.0.1.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.3.1.RELEASE\8342003919c7e5a2470072595ea190cb8a9552c0\spring-boot-starter-json-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.3.1.RELEASE\e0d28696fea064578cb01da346232284f922eba4\spring-boot-starter-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.3.1.RELEASE\5b599d0da04e724479c22daa47f9bfd62533a2e9\spring-boot-starter-tomcat-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.2.7.RELEASE\dcd97bcb0a2aa33f272b0031e4771134e327d942\spring-webmvc-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-web\5.2.7.RELEASE\50a27c77e1731f3b7af5c2ae7caf6fe59bcc309\spring-web-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\2.3.1.RELEASE\f42e23091d29bde8d1356e45cf13ad32dae51437\spring-boot-starter-aop-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\2.3.1.RELEASE\800b64e76588ea88761ad9108cde762204805d66\spring-boot-starter-jdbc-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\2.3.1.RELEASE\1b5e106add569913f0c776aca62f85d8e9ca8cee\spring-data-jpa-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.transaction\jakarta.transaction-api\1.3.3\c4179d48720a1e87202115fbed6089bdc4195405\jakarta.transaction-api-1.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.persistence\jakarta.persistence-api\2.2.3\8f6ea5daedc614f07a3654a455660145286f024e\jakarta.persistence-api-2.2.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.hibernate\hibernate-core\5.4.17.Final\3b90ecf6fe93a27a27de9671c9fb25d03ba3def7\hibernate-core-5.4.17.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-aspects\5.2.7.RELEASE\eb48f4ae3e1525179e1ccd10c0e09cfe5c27b8bb\spring-aspects-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.xml.bind\jakarta.xml.bind-api\2.3.3\48e3b9cfc10752fba3521d6511f4165bea951801\jakarta.xml.bind-api-2.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.activation\jakarta.activation-api\1.2.2\99f53adba383cb1bf7c3862844488574b559621f\jakarta.activation-api-1.2.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jooq\jooq\3.13.2\f356d70330b2aaa5f55858c192927f3e0d1bf89c\jooq-3.13.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\commons-beanutils\commons-beanutils\1.8.0\c651d5103c649c12b20d53731643e5fffceb536\commons-beanutils-1.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\commons-collections\commons-collections\3.2.1\761ea405b9b37ced573d2df0d1e3a4e0f9edc668\commons-collections-3.2.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.sf.ezmorph\ezmorph\1.0.6\1e55d2a0253ea37745d33062852fd2c90027432\ezmorph-1.0.6.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\commons-lang\commons-lang\2.5\b0236b252e86419eef20c31a44579d2aee2f0a69\commons-lang-2.5.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\commons-logging\commons-logging\1.1.1\5043bfebc3db072ed80fbd362e7caf00e885d8ae\commons-logging-1.1.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-beans\5.2.7.RELEASE\5465ab17688ed62254fdef411cf883fd5c3b77a\spring-beans-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-core\5.2.7.RELEASE\56e14a3a5e2813534b5db2da1502cd58ab5bc61d\spring-core-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.javassist\javassist\3.26.0-GA\bb2890849968d8d8311ffba8c37b0ce16ce284dc\javassist-3.26.0-GA.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.11.0\8f5aaf3878b0647ff3a16610af53b1a5c05d9f15\jackson-databind-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\mapper-extras-client\7.8.0\6f852909704bb95254700253cce524ddbec82518\mapper-extras-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\parent-join-client\7.8.0\f6a647512b571b91e8f70c4f7db322e1b8bc5f32\parent-join-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\aggs-matrix-stats-client\7.8.0\3a5f8ffae973a6d161e4db4276d47b0b79f69f92\aggs-matrix-stats-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\rank-eval-client\7.8.0\e85808baa79a93914b1a5ff8e69fbbde5c74cfb2\rank-eval-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch.plugin\lang-mustache-client\7.8.0\b1d124f3bf24a29dc3475930719c397c7f798ae9\lang-mustache-client-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.12\4023a2a80b64c25926911faf350b50cd2a29220f\httpclient-4.5.12.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.13\853b96d3afbb7bf8cc303fe27ee96836a10c1834\httpcore-4.4.13.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpasyncclient\4.1.4\f3a3240681faae3fa46b573a4c7e50cec9db0d86\httpasyncclient-4.1.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore-nio\4.4.13\3f897ace4d7f10f0ea6a58f524a3b105dd483653\httpcore-nio-4.4.13.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\commons-codec\commons-codec\1.14\3cb1181b2141a7e752f5bdc998b7ef1849f726cf\commons-codec-1.14.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-x-content\7.8.0\9cde4498a95ba2fddcc9986d2cc09b9fd8e3634\elasticsearch-x-content-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-cli\7.8.0\7f3df9c96fdc1e109bb1454618f4ad055d436998\elasticsearch-cli-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-core\7.8.0\f0e483035253f7da1d21586198adab2bf03fc0c9\elasticsearch-core-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-secure-sm\7.8.0\a5e2cff8506f9ef27534e35d3e75409477071dda\elasticsearch-secure-sm-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\elasticsearch-geo\7.8.0\63b2ff3a13e4678a046e427f02ae7130533ec0e5\elasticsearch-geo-7.8.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-core\8.5.1\24212de43c19269f5211f3e79eb2f414c4a0254b\lucene-core-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-analyzers-common\8.5.1\704685ddf536e1af4da025b6e6f4e50b9846ef18\lucene-analyzers-common-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-backward-codecs\8.5.1\ab12c24a7c33ef5dfe8b57f17f67fec4a3fee1c\lucene-backward-codecs-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-grouping\8.5.1\4404f3ff6341b7518843d09141df743bf91a8284\lucene-grouping-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-highlighter\8.5.1\142f5f249aa0803f8283a3d08615e37a56f40e8a\lucene-highlighter-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-join\8.5.1\b0a48846662fc504bd7796b5506dad94981fca08\lucene-join-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-memory\8.5.1\ba9e24b90323aacc98a4ac661ac34bfbf0ed66d8\lucene-memory-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-misc\8.5.1\a0418e9bc16fc876448accb828a6ca38ed63d4a8\lucene-misc-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-queries\8.5.1\269c67a4ee9b806cfdacddc211744243cbcbd127\lucene-queries-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-queryparser\8.5.1\ee5ba0e07a178a32987b0a92da149f2104e26dd9\lucene-queryparser-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-sandbox\8.5.1\f1461680109e499d8c58dcaf5d314aeeef41d99a\lucene-sandbox-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-spatial-extras\8.5.1\eece1ef3f919634c79b9ae9d99264ac9efa4276c\lucene-spatial-extras-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-spatial3d\8.5.1\a8fb2771ac562d60a3c945a4cef0e3742c390329\lucene-spatial3d-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.lucene\lucene-suggest\8.5.1\b5613f4995836fd9edae5925ed38559460721492\lucene-suggest-8.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.carrotsearch\hppc\0.8.1\ffc7ba8f289428b9508ab484b8001dea944ae603\hppc-0.8.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\joda-time\joda-time\2.10.4\8c10bb8815109067ce3c91a8e547b5a52e8a1c1a\joda-time-2.10.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.tdunning\t-digest\3.2\2ab94758b0276a8a26102adf8d528cf6d0567b9a\t-digest-3.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.hdrhistogram\HdrHistogram\2.1.9\e4631ce165eb400edecfa32e03d3f1be53dee754\HdrHistogram-2.1.9.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.13.3\ec1508160b93d274b1add34419b897bae84c6ca9\log4j-api-2.13.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.elasticsearch\jna\4.5.1\da10908ae23dc59b19dc258e63aea1c44621dc3a\jna-4.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.guava\failureaccess\1.0.1\1dcf1de382a0bf95a3d8b0849546c88bac1292c9\failureaccess-1.0.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\b421526c5f297295adef1c886e5246c39d4ac629\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\3.0.2\25ea2e8b0c338a877313bd4672d3fe056ea78f0d\jsr305-3.0.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.checkerframework\checker-qual\2.11.1\8c43bf8f99b841d23aadda6044329dad9b63c185\checker-qual-2.11.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.errorprone\error_prone_annotations\2.3.4\dac170e4594de319655ffb62f41cbd6dbb5e601e\error_prone_annotations-2.3.4.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.google.j2objc\j2objc-annotations\1.3\ba035118bc8bac37d7eff77700720999acd9986d\j2objc-annotations-1.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.11.0\cca91d6375258fd7ff2a6abb7bf91eef492bd606\jackson-datatype-jdk8-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.11.0\168b2d0e11478b9f0a1bfccd62d6b5e8547b1e6f\jackson-datatype-jsr310-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.11.0\950a1e9a7c1093e7ffd92b216d5a0667f1e39058\jackson-module-parameter-names-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.3.1.RELEASE\6d679d6ba26235a0e81ca1d58f9c1024d9427411\spring-boot-autoconfigure-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.3.1.RELEASE\ce8d8b6838ecceb68962b975b18682f4237ccf71\spring-boot-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.3.1.RELEASE\3f242a91ffddf7485fde1367e1354c7e13024c8\spring-boot-starter-logging-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.26\a78a8747147d2c5807683e76ec2b633e95c14fe9\snakeyaml-1.26.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.glassfish\jakarta.el\3.0.3\dab46ee1ee23f7197c13d7c40fce14817c9017df\jakarta.el-3.0.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\9.0.36\33fa5038aa66be6e9cc188000c2188aa4dd33c85\tomcat-embed-websocket-9.0.36.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\9.0.36\cf6574dd9c4764e60c548b69da52fc07a5a0a9bd\tomcat-embed-core-9.0.36.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-context\5.2.7.RELEASE\7fd9c4ea311a5d9ab92770be7fc93cc53db334f9\spring-context-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-aop\5.2.7.RELEASE\9cf69f8e888091684c05f0a287bb638502e90725\spring-aop-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-expression\5.2.7.RELEASE\c98d7b10f959f9bedfbbbd4d723cf7a1f17a1f71\spring-expression-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.5\1740dc9140103b796d1722668805fd4cf852780c\aspectjweaver-1.9.5.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-jdbc\5.2.7.RELEASE\847d31c90479a34e4e1fe7eeeb47ac89adce3438\spring-jdbc-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.zaxxer\HikariCP\3.4.5\aa1a2c00aae8e4ba8308e19940711bb9525b103d\HikariCP-3.4.5.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-orm\5.2.7.RELEASE\32a76d825d8782ff278abe124ded9620444b4a74\spring-orm-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\2.3.1.RELEASE\5ae66c24c223315d5b31a45590d293e9145c18e9\spring-data-commons-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.30\b5a4b6d16ab13e34a88fae84c35cd5d68cac922c\slf4j-api-1.7.30.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\2.3.3\c46b68a6e3a2d84ba4eb14c6a8a1a9a7be4048bc\jaxb-runtime-2.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\antlr\antlr\2.7.7\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.10.11\16ac7e0d4afef10ac30db377e8151aff66a90e1c\byte-buddy-1.10.11.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\5.1.0.Final\700aeedc4a2089816621948f0379e17cbd17d5db\hibernate-commons-annotations-5.1.0.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.4.1.Final\40fd4d696c55793e996d1ff3c475833f836c2498\jboss-logging-3.4.1.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.jboss\jandex\2.1.3.Final\cd56603e39eb1421560b71daa584348ecfd9e0b8\jandex-2.1.3.Final.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.dom4j\dom4j\2.1.3\a75914155a9f5808963170ec20653668a2ffd2fd\dom4j-2.1.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.reactivestreams\reactive-streams\1.0.3\d9fb7a7926ffa635b3dcaa5049fb2bfa25b3e7d0\reactive-streams-1.0.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\javax.xml.bind\jaxb-api\2.3.1\8531ad5ac454cc2deb9d4d32c40c4d7451939b5d\jaxb-api-2.3.1.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.2.7.RELEASE\72282e1f89c58284632220437b5a1e8066c53d7d\spring-jcl-5.2.7.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.11.0\c626020ae55d19c690d25cb51c1532ba76e5890f\jackson-annotations-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.11.0\f84302e14648f9f63c0c73951054aeb2ff0b810a\jackson-core-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.github.spullara.mustache.java\compiler\0.9.6\1b8707299c34406ed0ba40bbf8513352ac4765c9\compiler-0.9.6.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.dataformat\jackson-dataformat-cbor\2.11.0\3d9b7ba55da2883823b34eb9a33f186688098400\jackson-dataformat-cbor-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.dataformat\jackson-dataformat-smile\2.11.0\a232adc9dc1dfa5ba97aa6b065e556c2872614b0\jackson-dataformat-smile-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.fasterxml.jackson.dataformat\jackson-dataformat-yaml\2.11.0\f5314fe164fc1e3bdcaf20fe0851759917312d9e\jackson-dataformat-yaml-2.11.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\net.sf.jopt-simple\jopt-simple\5.0.2\98cafc6081d5632b61be2c9e60650b64ddbc637c\jopt-simple-5.0.2.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.13.3\966f6fd1af4959d6b12bfa880121d4a2b164f857\log4j-to-slf4j-2.13.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.30\d58bebff8cbf70ff52b59208586095f467656c30\jul-to-slf4j-1.7.30.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\2.3.3\12f70b0ea4fc1ad45315e842f63f7c9a46f46530\txw2-2.3.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\3.0.11\4293b5f4e4e89d598f62bb2ba73b32132e7c3a27\istack-commons-runtime-3.0.11.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\javax.activation\javax.activation-api\1.2.0\85262acf3ca9816f9537ca47d5adeabaead7cb16\javax.activation-api-1.2.0.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-devtools\2.3.1.RELEASE\8f976b7b525d0f0b9c175c2fa5dfe9a07aa48503\spring-boot-devtools-2.3.1.RELEASE.jar;E:\gradle\gradle-5.6.4\caches\modules-2\files-2.1\com.sun.activation\jakarta.activation\1.2.2\74548703f9851017ce2f556066659438019e7eb5\jakarta.activation-1.2.2.jar;E:\JetBrains\IntelliJ IDEA 2020.1.4\lib\idea_rt.jar" com.zsx.MyJooqApplication
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Connected to the target VM, address: '127.0.0.1:59350', transport: 'socket'
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
 
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.1.RELEASE)
 
2020-08-22 15:21:47.372  INFO 17512 --- [  restartedMain] com.zsx.MyJooqApplication                : Starting MyJooqApplication on zsx with PID 17512 (F:\IdeaProjects\my-jooq\out\production\classes started by 18273 in F:\IdeaProjects\my-jooq)
2020-08-22 15:21:47.374  INFO 17512 --- [  restartedMain] com.zsx.MyJooqApplication                : No active profile set, falling back to default profiles: default
2020-08-22 15:21:47.408  INFO 17512 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-08-22 15:21:47.408  INFO 17512 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-08-22 15:21:47.988  INFO 17512 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-08-22 15:21:48.007  INFO 17512 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14ms. Found 0 JPA repository interfaces.
2020-08-22 15:21:48.471  INFO 17512 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8088 (http)
2020-08-22 15:21:48.478  INFO 17512 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-08-22 15:21:48.479  INFO 17512 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.36]
2020-08-22 15:21:48.549  INFO 17512 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-08-22 15:21:48.549  INFO 17512 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1141 ms
2020-08-22 15:21:48.575  INFO 17512 --- [  restartedMain] c.z.f.RequestBodyParameterReadingFilter  : =========RequestBodyParameterReadingFilter.init()=========
2020-08-22 15:21:48.641  INFO 17512 --- [  restartedMain] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 6.4.0 by Redgate
2020-08-22 15:21:48.645  WARN 17512 --- [  restartedMain] com.zaxxer.hikari.HikariConfig           : HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool.
2020-08-22 15:21:48.645  INFO 17512 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-08-22 15:21:48.707  INFO 17512 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2020-08-22 15:21:48.718  INFO 17512 --- [  restartedMain] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:postgresql://127.0.0.1:5432/my-jooq (PostgreSQL 12.0)
2020-08-22 15:21:48.739  INFO 17512 --- [  restartedMain] o.f.core.internal.command.DbValidate     : Successfully validated 2 migrations (execution time 00:00.011s)
2020-08-22 15:21:48.743  INFO 17512 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Current version of schema "jooq": 1
2020-08-22 15:21:48.743  INFO 17512 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Schema "jooq" is up to date. No migration necessary.
2020-08-22 15:21:48.798  INFO 17512 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-08-22 15:21:48.803  INFO 17512 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'taskScheduler'
2020-08-22 15:21:48.842  INFO 17512 --- [         task-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-08-22 15:21:48.846  INFO 17512 --- [  restartedMain] com.zsx.config.WebErrorConfiguration     : =========WebErrorConfiguration.errorAttributes()=========
2020-08-22 15:21:48.852  INFO 17512 --- [  restartedMain] com.zsx.error.CustomizeErrorController   : =========CustomizeErrorController.CustomizeErrorController()=========
2020-08-22 15:21:48.903  INFO 17512 --- [         task-1] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.17.Final
2020-08-22 15:21:49.034  INFO 17512 --- [         task-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-08-22 15:21:49.147  INFO 17512 --- [         task-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2020-08-22 15:21:49.184  WARN 17512 --- [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-08-22 15:21:49.299  INFO 17512 --- [         task-1] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-08-22 15:21:49.308  INFO 17512 --- [         task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-08-22 15:21:49.672  INFO 17512 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-08-22 15:21:49.720  INFO 17512 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8088 (http) with context path ''
2020-08-22 15:21:49.722  INFO 17512 --- [  restartedMain] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-08-22 15:21:49.723  INFO 17512 --- [  restartedMain] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-08-22 15:21:49.733  INFO 17512 --- [  restartedMain] com.zsx.MyJooqApplication                : Started MyJooqApplication in 5.2 seconds (JVM running for 5.834)
2020-08-22 15:22:22.085  INFO 17512 --- [nio-8088-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-08-22 15:22:22.086  INFO 17512 --- [nio-8088-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-08-22 15:22:22.090  INFO 17512 --- [nio-8088-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 4 ms
2020-08-22 15:22:26.415  INFO 17512 --- [nio-8088-exec-1] c.z.f.RequestBodyParameterReadingFilter  : =========RequestBodyParameterReadingFilter.doFilter()=========
2020-08-22 15:22:29.158  INFO 17512 --- [nio-8088-exec-1] c.z.f.RequestBodyParameterReadingFilter  : =========RequestBodyParameterReadingFilter.doFilter().jsonRequest=========
2020-08-22 15:22:29.221  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.CustomizeHttpServletRequestWrapper()=========
2020-08-22 15:22:29.549  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.getInputStream()=========
2020-08-22 15:22:38.373  INFO 17512 --- [nio-8088-exec-1] c.zsx.exception.GlobalExceptionHandler1  : =========GeneralExceptionHandler.exception()=========
2020-08-22 15:22:38.749  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.CustomizeHttpServletRequestWrapper()=========
2020-08-22 15:22:38.749  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.getInputStream()=========
2020-08-22 15:22:39.078  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.getReader()=========
2020-08-22 15:22:39.080  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.getInputStream()=========
2020-08-22 15:22:52.032  INFO 17512 --- [nio-8088-exec-1] c.zsx.exception.GlobalExceptionHandler1  : RequestBody Parameters : {    "name": "zsx",    "age": 20}
2020-08-22 15:22:53.573 ERROR 17512 --- [nio-8088-exec-1] c.zsx.exception.GlobalExceptionHandler1  : GeneralExceptionHandler.exception() : Test RuntimeException
2020-08-22 15:22:59.374  INFO 17512 --- [nio-8088-exec-1] c.zsx.exception.GlobalExceptionHandler1  : =========GeneralExceptionHandler.handleExceptionInternal()=========
2020-08-22 15:23:00.326  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.getReader()=========
2020-08-22 15:23:00.327  INFO 17512 --- [nio-8088-exec-1] c.z.h.CustomizeHttpServletRequestWrapper : =========CustomizeHttpServletRequestWrapper.getInputStream()=========
2020-08-22 15:23:01.363  INFO 17512 --- [nio-8088-exec-1] c.zsx.exception.GlobalExceptionHandler1  : RequestBody Parameters : {    "name": "zsx",    "age": 20}
2020-08-22 15:23:05.272  WARN 17512 --- [nio-8088-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.RuntimeException: Test RuntimeException]

从以上控制台打印结果可以看出获取参数结果成功!

以上为个人经验,希望能给大家一个参考,也希望大家多多支持我们。

(0)

相关推荐

  • SpringBoot拦截器如何获取http请求参数

    1.1.获取http请求参数是一种刚需 我想有的小伙伴肯定有过获取http请求的需要,比如想 前置获取参数,统计请求数据 做服务的接口签名校验 敏感接口监控日志 敏感接口防重复提交 等等各式各样的场景,这时你就需要获取 HTTP 请求的参数或者请求body,一般思路有两种,一种就是自定义个AOP去拦截目标方法,第二种就是使用拦截器.整体比较来说,使用拦截器更灵活些,因为每个接口的请求参数定义不同,使用AOP很难细粒度的获取到变量参数,本文主线是采用拦截器来获取HTTP请求. 1.2.定义拦截器获

  • Spring boot @RequestBody数据传递过程详解

    这篇文章主要介绍了Spring boot @RequestBody数据传递过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 @RequestBody需要接的参数是一个string化的json @RequestBody,要读取的数据在请求体里,所以要发post请求,还要将Content-Type设置为application/json java的api 参数为JSONObject,获取到的参数处理 @PostMapping("/combine

  • java通过HttpServletRequest获取post请求中的body内容的方法

    在java web应用中,我们如何获取post请求body中的内容?以及需要注意的问题. 通常利用request获取参数可以直接通过req.getParameter(name)的方式获取url上面或者ajax data提交上来的参数.但是body是没有名字的,无法通过参数名字这种方式获取.这时候需要用到io流的方式来获取body中的内容. 这里先贴出一段代码: package com.lenovo.servlet; import java.io.BufferedReader; import ja

  • Springboot拦截器如何获取@RequestBody参数

    Springboot拦截器获取@RequestBody参数 HttpContextUtils import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader;

  • SpringBoot 拦截器和自定义注解判断请求是否合法

    应用场景举例: 当不同身份的用户请求一个接口时,用来校验用户某些身份,这样可以对单个字段数据进行精确权限控制,具体看代码注释 自定义注解 /** * 对比请求的用户身份是否符合 * @author liuyalong * @date 2020/9/25 16:03 */ @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) public @interface CompareUser { /** * The name

  • SpringBoot拦截器的使用介绍

    目录 定义拦截器 实现HandleInterceptor接口 继承HandleInterceptorAdapter类 实现WebRequestInterceptor接口 实现RequestInterceptor接口 小插曲 @Configuration和@Component区别 注册拦截器 继承WebMvcConfigurerAdapter类 继承WebMvcConfigurationSupport类 实现WebMvcConfigurer接口 应用场景 拦截器执行流程 单个拦截器 多个拦截器 总

  • SpringBoot拦截器与文件上传实现方法与源码分析

    目录 一.拦截器 1.创建一个拦截器 2.配置拦截器 二.拦截器原理 三.文件上传 四.文件上传流程 一.拦截器 拦截器我们之前在springmvc已经做过介绍了 大家可以看下[SpringMVC]自定义拦截器和过滤器 为什么在这里还要再讲一遍呢? 因为spring boot里面对它做了简化,大大节省了我们配置那些烦人的xml文件的时间 接下来,我们就通过一个小例子来了解一下拦截器在spring boot中的使用 1.创建一个拦截器 首先我们创建一个拦截器,实现HandlerIntercepto

  • springboot拦截器过滤token,并返回结果及异常处理操作

    1.springboot 拦截器处理过滤token,并且返回结果 import org.apache.commons.lang3.StringUtils; import org.apache.shiro.subject.Subject; import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; import org.springframework.web.servlet.H

  • springboot拦截器无法注入redisTemplate的解决方法

    在工作中我们经常需要做登录拦截验证或者其他拦截认证功能,基于springboot项目下我们很容易想到结合redis做的分布式拦截,把用户登录或者需要验证的信息放到redis里面.但是在写拦截器的时候发现redisTemplate一直无法注入进来,最后查资料才发现springboot拦截器是在Bean实例化之前执行的,所以Bean实例无法注入. 先看下问题,新建一个拦截器,然后注入redisTemplate /** * @author: lockie * @Date: 2019/8/13 16:1

  • SpringBoot 拦截器妙用你真的了解吗

    HandlerInterceptor 详解 HandlerInterceptor 允许定制 handler 处理器执行链的工作流接口.我们可以自定义拦截器用于拦截 handlers 处理器(你可以理解为 controller 层的接口),从而可以添加一些共同的重复性的处理行为(例如接口鉴权,接口日志记录,性能监控等),而不用修改每一个 handler 的实现. 注意,此基于 SpringBoot 2.3.12.RELEASE 版本讲解. HandlerInterceptor 接口只有三个默认空实

  • SpringBoot拦截器以及源码详析

    目录 1.拦截器是什么 2.自定义拦截器 2.1 编写拦截器 2.2 注册和配置拦截器 3.拦截器原理 3.1 找到可以处理请求的handler以及handler的所有拦截器 3.2 执行拦截器的preHandle方法 3.3 执行目标方法 3.4 执行拦截器的postHandle方法 3.5 执行拦截器的afterCompletion方法 3.6 异常处理 4.总结 1.拦截器是什么 java里的拦截器(Interceptor)是动态拦截Action调用的对象,它提供了一种机制可以使开发者在一

  • springboot拦截器Interceptor的使用,你都了解吗

    springmvc 中的拦截器可以对请求进行判别, 在请求到达控制器之前, 把非法的请求给拦截掉 下面来说一说, 它在springboot中的使用 拦截器是可以有多个的, 对不同的 url 进行拦截 我们这个例子设想的是, 如果用户登录过, 就会用户设置一个 session , 如果session中 有user 的信息,就说明用户是登录过的 1.我们先创建一个 User 的实例对象 domain public class User { private Integer id; private St

随机推荐