简体   繁体   English

我怎么知道我正在使用什么 jaxrs 实现?

[英]How do I know what implementation of jaxrs I am using?

I have a Java 1.7 starts application.我有一个 Java 1.7 启动应用程序。 It does have some RESTful api's.它确实有一些 RESTful api。

I would like to add @JsonIgnore to a filed so that it is not returned in the api.我想将@JsonIgnore添加到归档中,以便它不会在 api 中返回。

Eg例如

Member.java会员.java

import com.fasterxml.jackson.annotation.JsonIgnore;
    
private java.lang.String username;
@JsonIgnore
private java.lang.String password;

Does not ignore the password.不忽略密码。

"member": {
    "password": "**************",
    "username": "richard"
}

I think the reason why @JsonIgnore does not work, is because I use com.fasterxml.jackson.annotation.JsonIgnore .我认为@JsonIgnore不起作用的原因是因为我使用com.fasterxml.jackson.annotation.JsonIgnore Should I use a different annotation from a different library?我应该使用来自不同库的不同注释吗? ie Is my implementation of jaxrs maybe not com.fasterxml.jackson ?即我的 jaxrs 实现可能不是com.fasterxml.jackson吗? How do I tell?我该怎么说?

The IntelliJ classpath has: IntelliJ 类路径具有:

在此处输入图像描述

(I have tried net.minidev.json.annotate.JsonIgnore with no success) (我试过net.minidev.json.annotate.JsonIgnore没有成功)

More info:更多信息:

pom.xml pom.xml

<dependency>
    <groupId>net.minidev</groupId>
    <artifactId>json-smart</artifactId>
    <version>2.3</version>
</dependency>

and

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.11.2</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.11.2</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.11.2</version>
</dependency>

在此处输入图像描述

Is this the problem?这是问题吗? two versions.两个版本。 I am not sure where the 2.0,5 version comes from.我不确定 2.0,5 版本来自哪里。 as it is not defined in the pom.因为它没有在 pom 中定义。

在此处输入图像描述

You don't need a @JsonIgnore in this case.在这种情况下,您不需要 @JsonIgnore。 You can simply omit the variable that you don't want deserialized(the password in this case) and jackson will just return you the username.您可以简单地省略您不想反序列化的变量(在这种情况下为密码),jackson 只会返回您的用户名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在为我的班级使用 java 在 JGrasp 中制作一个神奇的 8 球。 如何让我的代码运行? 我不知道我的错误是什么或如何解决它? - I am working on making a magic 8 ball in JGrasp using java for my class. how do I get my code to run? I do not know what my error is or how to fix it? 我如何知道我正在回复的OkHttp电话 - How do I know what OkHttp call I am returning from 我如何知道我使用的是Triple Des Algorithm实现的正确版本? - How do I know if I'm using the right version of Triple Des Algorithm implementation? 如何知道我是否正在使用Java EE? - How to know if I am using Java EE? 通过WiFi下载数据时,如何知道我已通过Wifi连接 - When downloading data over WiFi, how do I know I am connected using Wifi CXF JAXRS - 如何将日期作为 QueryParam 传递 - CXF JAXRS - How do I pass Date as QueryParam 我怎么知道我正在运行哪个版本的RichFaces? - How do I know which version of RichFaces I am running? 我怎么知道这是一种什么样的方法? - how do i know what kind of method is this? 是否可以上传file.xlsx,进行处理而不将其保存在服务器中? 我正在使用jaxrs - Is possible to upload a file.xlsx, process it without save it in server? I am using jaxrs 我正在尝试打开我的文本文件,但我不知道问题出在哪里 - I am trying to open my text file but I do not know what the issue is
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM