简体   繁体   中英

'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. I am getting this error when I am using 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:

This API is deprecated and has been replaced by 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

So just use ModulesService from now on and convert it via the link mentioned in the docs.

For everyone facing this issue, you can actually just do it without declaring 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM