我正在使用 Jersey 2.17、JSON 和自动功能发现。
我有我的自定义 JSON 提供程序扩展JacksonJsonProvider. 它带有注释@Provider并自动注册,与附带的默认注释相同:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我想禁用/排除默认选项,而不放弃功能扫描/手动注册所有内容。
我想出的唯一解决方案是@Priority(Integer.MAX_VALUE)确保我的提供商具有更高的优先级,但我不喜欢依赖优先级的想法。
尝试过jersey.config.disableJsonProcessing,但似乎没有改变任何东西
我无法定义@Result注释的'type'参数
这是我的动作注释:
@Action(value="login",
results=@Result(name="success",location="index.page", type="tiles" ))
Run Code Online (Sandbox Code Playgroud)
其中index.page是我的tile定义,我如何定义'tiles'实际上是tile结果?
在我使用struts.xml进行配置之前,我可以放在那里
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
Run Code Online (Sandbox Code Playgroud)
无论我尝试什么,我总是得到:
SEVERE: Dispatcher initialization failed
Unable to load configuration. - [unknown location]
...
Caused by: The Result type [tiles] which is defined in the Result annotation ...
could not be found as a result-type defined for the Struts/XWork package
[com.action#convention-default#] - [unknown location]
Run Code Online (Sandbox Code Playgroud)