过去几天我一直在搜索和尝试不同的设置而没有运气。使用Tomcat7,Jerseyv2.1,Jacksonv2.8.4,除了ContextResolver()之外,一切似乎都在使用。它初始化但getContext()永远不会被调用 下面是web.xml
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.rest.provider,com.rest</param-value>
</init-param>
<init-param>
<param-name>org.glassfish.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
下面是ObjectMapper:
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.rest.provider,com.rest</param-value>
</init-param>
<init-param>
<param-name>org.glassfish.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
我可以看到&#34;开始&#34;和&#34; Init ObjectMapperContextResolver&#34;在日志中但我从未看到getContext()被调用。任何关于这种情况的想法或帮助将不胜感激。