[英]'com.google.appengine.api.backends.BackendService' is deprecated alternative
'com.google.appengine.api.backends.BackendService' is deprecated less... This inspection reports where deprecated code is used in the specified inspection scope. 不建议使用com.google.appengine.api.backends.BackendService。...此检查报告指定的检查范围中使用了不赞成使用的代码。 I am getting this error when I am using BackendService for Google. 我在使用BackendService for Google时遇到此错误。 Is there any alternatives to replace this? 是否有其他替代方法?
import com.google.appengine.api.backends.BackendService;
BackendService backendsApi = BackendServiceFactory.getBackendService();
You can just look it up in the docs of com.google.appengine.api.backends.BackendService
where it says: 您可以在com.google.appengine.api.backends.BackendService
的文档中查找它,其中显示:
This API is deprecated and has been replaced by ModulesService . 该API已弃用,并已由ModulesService取代。 Please update your code as soon as possible. 请尽快更新您的代码。 See the modules documentation for more information: https://developers.google.com/appengine/docs/java/modules/converting 有关更多信息,请参见模块文档: https : //developers.google.com/appengine/docs/java/modules/converting
So just use ModulesService
from now on and convert it via the link mentioned in the docs. 因此,从现在开始使用ModulesService
并通过文档中提到的链接对其进行转换。
For everyone facing this issue, you can actually just do it without declaring BackendService. 对于面对此问题的每个人,您实际上都可以这样做,而无需声明BackendService。 For example when used in a queue: 例如,在队列中使用时:
queue.add(TaskOptions.Builder.withUrl("/test")
.param("testing","a")
.header("Host",BackendServiceFactory.getBackendService().getBackendAddress("backend")));
answer can also be found here How to set targeted Modules for specific URL in AppEngine + Java 答案也可以在这里找到如何在AppEngine + Java中为特定的URL设置目标模块
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.