class StrategyEnvironmentEnabledFilter extends AbstractStrategyEnabledFilter {
    @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_ENVIRONMENT_FAILOVER_ENABLED + ":false}")
    protected Boolean environmentFailoverEnabled;

    @Override
    public boolean apply(List<? extends Server> servers, Server server) {<FILL_FUNCTION_BODY>}

    @Override
    public int getOrder() {
        return HIGHEST_PRECEDENCE + 3;
    }
}

        String environment = pluginContextHolder.getContextRouteEnvironment();
        if (StringUtils.isEmpty(environment)) {
            return true;
        }

        String serverEnvironment = pluginAdapter.getServerEnvironment(server);

        boolean found = findByEnvironment(servers, environment);
        if (found) {
            // 匹配到传递过来的环境Header的服务实例，返回匹配的环境的服务实例
            return StringUtils.equals(serverEnvironment, environment);
        } else {
            if (environmentFailoverEnabled) {
                String serviceId = pluginAdapter.getServerServiceId(server);

                // 没有匹配上，则寻址Common环境，返回Common环境的服务实例
                String environmentFailovers = JsonUtil.fromJsonMap(pluginContextHolder.getContextRouteEnvironmentFailover(), serviceId);
                if (StringUtils.isEmpty(environmentFailovers)) {
                    environmentFailovers = StrategyConstant.SPRING_APPLICATION_STRATEGY_ENVIRONMENT_FAILOVER_VALUE;
                }

                return discoveryMatcher.match(environmentFailovers, serverEnvironment, true);
            }
        }

        return StringUtils.equals(serverEnvironment, environment);
    
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolean findByRegion(List<? extends Server>, java.lang.String) ,public boolean findByVersion(List<? extends Server>, java.lang.String) ,public boolean findByZone(List<? extends Server>, java.lang.String) ,public com.nepxion.discovery.plugin.strategy.matcher.DiscoveryMatcher getDiscoveryMatcher() ,public com.nepxion.discovery.plugin.framework.adapter.PluginAdapter getPluginAdapter() ,public com.nepxion.discovery.plugin.framework.context.PluginContextHolder getPluginContextHolder() ,public boolean matchByAddress(List<? extends Server>, java.lang.String) ,public boolean matchByRegion(List<? extends Server>, java.lang.String) ,public boolean matchByVersion(List<? extends Server>, java.lang.String) <variables>protected com.nepxion.discovery.plugin.strategy.matcher.DiscoveryMatcher discoveryMatcher,protected com.nepxion.discovery.plugin.framework.adapter.PluginAdapter pluginAdapter,protected com.nepxion.discovery.plugin.framework.context.PluginContextHolder pluginContextHolder,protected java.lang.String sortType