@Bean
public ResourceConfig resourceConfig() {
ResourceConfig resourceConfig = new ResourceConfig(); // 用FastJson替换掉默认的Jackson
resourceConfig.register(FastJsonResolver.class);
resourceConfig.register(FastJsonFeature.class); return resourceConfig;
} @Provider
static class FastJsonResolver implements ContextResolver<FastJsonConfig> {
// 用FastJson替换掉默认的Jackson
public FastJsonConfig getContext(Class<?> type) {
FastJsonConfig fastJsonConfig = new FastJsonConfig();
return fastJsonConfig;
} }