@Override
    public ExecuteContext before(ExecuteContext context) {
        Object object = context.getObject();
        if (object instanceof AbstractAutoServiceRegistration) {
            AbstractAutoServiceRegistration<?> serviceRegistration = (AbstractAutoServiceRegistration<?>) object;
            try {
                Registration registration = (Registration) ReflectUtils.getAccessibleObject(
                        serviceRegistration.getClass().getDeclaredMethod("getRegistration"))
                        .invoke(serviceRegistration);
                AppCache.INSTANCE.setAppName(registration.getServiceId());
                SpringRouterUtils.putMetaData(registration.getMetadata(), routerConfig);
            } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException ex) {
                LOGGER.log(Level.WARNING, "Can not get the registration.", ex);
            }
        }
        return context;
    }
@Test
    public void testBefore() {
        interceptor.before(context);
        Assert.assertEquals("foo", AppCache.INSTANCE.getAppName());
        TestServiceRegistration registration = (TestServiceRegistration) context.getObject();
        Map<String, String> metadata = registration.getRegistration().getMetadata();
        Assert.assertEquals(routerConfig.getRouterVersion(), metadata.get("version"));
        Assert.assertEquals("bar1", metadata.get("bar"));
        Assert.assertEquals("foo2", metadata.get("foo"));
    }