@Override
    public ExecuteContext before(ExecuteContext context) {
        if (!(context.getObject() instanceof Builder)) {
            return context;
        }
        init();
        Builder builder = (Builder) context.getObject();
        Optional<Object> filters = ReflectUtils.getFieldValue(builder, "filters");
        if (filters.isPresent()) {
            List<ExchangeFilterFunction> list = (List<ExchangeFilterFunction>) filters.get();
            for (ExchangeFilterFunction filterFunction : list) {
                if (filterFunction instanceof RouterExchangeFilterFunction) {
                    // If it has already been injected and retried, it will not be injected again
                    return context;
                }
            }

            // When a filter is present, inject into the first one
            list.add(0, new RouterExchangeFilterFunction());
            return context;
        }
        builder.filter(new RouterExchangeFilterFunction());
        return context;
    }
@Test
    public void testBefore() {
        // When no filter exists
        interceptor.before(context);
        List<ExchangeFilterFunction> list = (List<ExchangeFilterFunction>) ReflectUtils
                .getFieldValue(builder, "filters").orElse(null);
        Assert.assertNotNull(list);
        Assert.assertTrue(list.get(0) instanceof RouterExchangeFilterFunction);

        // When the RouterExchangeFilterFunction already exists
        interceptor.before(context);
        list = (List<ExchangeFilterFunction>) ReflectUtils.getFieldValue(builder, "filters").orElse(null);
        Assert.assertNotNull(list);
        Assert.assertTrue(list.get(0) instanceof RouterExchangeFilterFunction);
        Assert.assertEquals(1, list.size());

        // Clear the data
        ReflectUtils.setFieldValue(builder, "filters", null);

        // Test the case where you already have a filter
        ExchangeFilterFunction function = (clientRequest, exchangeFunction) -> exchangeFunction.exchange(clientRequest);
        builder.filter(function);
        interceptor.before(context);
        list = (List<ExchangeFilterFunction>) ReflectUtils.getFieldValue(builder, "filters").orElse(null);
        Assert.assertNotNull(list);
        Assert.assertEquals(2, list.size());
        Assert.assertTrue(list.get(0) instanceof RouterExchangeFilterFunction);
        Assert.assertEquals(function, list.get(1));
    }