0

'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();
CloudSeph
  • 863
  • 4
  • 15
  • 36

2 Answers2

1

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.

Lino
  • 19,604
  • 6
  • 47
  • 65
1

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

CloudSeph
  • 863
  • 4
  • 15
  • 36