com.alibaba.fastjson.support.jaxrs.FastJsonAutoDiscoverable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastjson-to-easyjson Show documentation
Show all versions of fastjson-to-easyjson Show documentation
Adapter alibaba fastjson to other json libraries. the fastjson version: 1.2.58
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;
/**
* Title: FastJsonAutoDiscoverable
* Description: FastJsonAutoDiscoverable
*
* @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);
}
}
}