gpt4 book ai didi

java - 父类(super class)型没有实现和覆盖

转载 作者:行者123 更新时间:2023-12-01 09:22:04 24 4
gpt4 key购买 nike

现在我正在编写接口(interface)并实现该接口(interface),我面临以下问题。任何人都可以解决此代码可能存在的问题吗?

public interface TokenValidateApi {

String URI_API_TOKEN = "/api/rcsAccessCheck/";

ResponseBuilder validateIDMToken(String token);

Response createProductInJSON();
}

这是我的实现类,现在我面临以下“方法不会覆盖或实现父类(super class)型的方法”

@Component
@Path("/rcsAccessCheck")
@Api(value = "/rcsAccessCheck", description = "The token validation is for IDM Token validation. (internal use only)")
public class TokenValidateApiImpl extends RestEndpoint implements TokenValidateApi {

@Autowired
private IdmRequestTokenProvider requestTokenProvider;

@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/validateToken")
@ApiOperation(value = "Returns the Token Authenticatication response")
@ApiResponses(value = {@ApiResponse(code = 404, message = "The validate token service doesn't exist."),
@ApiResponse(code = 403, message = "Authorization failure")})
@Override
public ResponseBuilder validateIDMToken(@HeaderParam("IDMToken") String token) {
System.out.println("Print the IDM TOKEN FROM RCS WAR:::::"+token);
AuthenticationSuccessResponse response = requestTokenProvider.validateToken(token);

return Response.ok(response);

}

@GET
@Path("/post")
@Consumes("application/json")
@Produces(MediaType.APPLICATION_JSON)
@Override
public Response createProductInJSON() {

System.out.println("comes HErs");
//String result = "Product created : " + product;
return Response.status(201).build();

}
}

最佳答案

将注释放在接口(interface)及其方法上。然后只需在类中重写其方法即可。也许它会起作用。

关于java - 父类(super class)型没有实现和覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40108972/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com