@Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) {
        Set<String> matchKeys = configService.getMatchKeys();
        Set<String> injectTags = configService.getInjectTags();
        if (CollectionUtils.isEmpty(matchKeys) && CollectionUtils.isEmpty(injectTags)) {
            // The staining mark is empty, which means that there are no staining rules, and it is returned directly
            return true;
        }
        Map<String, List<String>> headers = getHeaders(request);
        Map<String, String[]> parameterMap = request.getParameterMap();
        String path = request.getRequestURI();
        String method = request.getMethod();
        handlers.forEach(handler -> ThreadLocalUtils.addRequestTag(
                handler.getRequestTag(path, method, headers, parameterMap, new Keys(matchKeys, injectTags))));
        return true;
    }
@Test
    public void testPreHandle() {
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addHeader("bar", "bar1");
        request.addHeader("foo", "foo1");
        request.addHeader("foo2", "foo2");
        MockHttpServletResponse response = new MockHttpServletResponse();
        Object obj = new Object();

        // The test keys are all empty
        configService.setReturnEmptyWhenGetMatchTags(true);
        configService.setReturnEmptyWhenGetMatchKeys(true);
        interceptor.preHandle(request, response, obj);
        Assert.assertNull(ThreadLocalUtils.getRequestTag());

        // Test the preHandle method, getMatchKeys is not empty
        configService.setReturnEmptyWhenGetMatchTags(true);
        configService.setReturnEmptyWhenGetMatchKeys(false);
        interceptor.preHandle(request, response, obj);
        RequestTag requestTag = ThreadLocalUtils.getRequestTag();
        Map<String, List<String>> header = requestTag.getTag();
        Assert.assertNotNull(header);
        Assert.assertEquals(2, header.size());
        Assert.assertEquals("bar1", header.get("bar").get(0));
        Assert.assertEquals("foo1", header.get("foo").get(0));
    }