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 static final String FASTJSON_AUTO_DISCOVERABLE = "fastjson.auto.discoverable";

    public volatile static boolean autoDiscover = true;

    static {
        try {
            autoDiscover = Boolean.parseBoolean(System.getProperty(FASTJSON_AUTO_DISCOVERABLE, String.valueOf(autoDiscover)));
        } catch (SecurityException ex) {
            //skip
        }
    }

    @Override
    public void configure(final FeatureContext context) {

        final Configuration config = context.getConfiguration();

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

            context.register(FastJsonFeature.class);
        }
    }

}

@@ -718,16 +718,37 @@
 Boolean(
+%0A                    
 System.g
@@ -839,25 +839,17 @@
 ch (
-SecurityException
+Throwable
  ex)
@@ -891,22 +891,8 @@
  %7D%0A%0A
-    @Override%0A
     

refactor for pull request #3387