Search code examples
javagoogle-app-enginegoogle-apigoogle-appsgoogle-api-java-client

'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();

Solution

  • 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