package com.alibaba.fastjson.support.jaxrs;

import org.glassfish.jersey.internal.spi.AutoDiscoverable;

import javax.annotation.Priority;
import javax.ws.rs.core.Configuration;
import javax.ws.rs.core.FeatureContext;

/**
 * <p>Title: FastJsonAutoDiscoverable</p>
 * <p>Description: FastJsonAutoDiscoverable</p>
 *
 * @author Victor.Zxy
 * @see AutoDiscoverable
 * @since 1.2.37
 */
@Priority(AutoDiscoverable.DEFAULT_PRIORITY - 1)
public class FastJsonAutoDiscoverable implements AutoDiscoverable {

    public volatile static boolean autoDiscover = true;

    @Override
    public void configure(final FeatureContext context) {

        final Configuration config = context.getConfiguration();

        // Register FastJson.
        if (!config.isRegistered(FastJsonFeature.class) && autoDiscover) {

            context.register(FastJsonFeature.class);
        }
    }
}

@@ -510,52 +510,286 @@
 lic 
-volatile static boolean autoDiscover = true;
+static final String FASTJSON_AUTO_DISCOVERABLE = %22fastjson.auto.discoverable%22;%0A%0A    public volatile static boolean autoDiscover = true;%0A%0A    static %7B%0A        autoDiscover = Boolean.parseBoolean(System.getProperty(FASTJSON_AUTO_DISCOVERABLE, String.valueOf(autoDiscover)));%0A    %7D
 %0A%0A  
@@ -1100,10 +1100,11 @@
 %7D%0A    %7D%0A
+%0A
 %7D%0A

add close discover switch