小编sv1*_*v13的帖子

Jersey:禁用默认 JSON 提供程序

我正在使用 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,但似乎没有改变任何东西

java jersey jackson jersey-2.0

5
推荐指数
1
解决办法
3596
查看次数

Struts2,如何将@Result类型参数定义为tile结果

我无法定义@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)

annotations struts2 tiles2

0
推荐指数
1
解决办法
7050
查看次数

标签 统计

annotations ×1

jackson ×1

java ×1

jersey ×1

jersey-2.0 ×1

struts2 ×1

tiles2 ×1