How i remove Globalsettings in Java?

I am upgrading my Play Application. I dont understand how to remove Globalsettings. Can somebody help me? This was my globalsettings code in version 2.2.2, now i want to upgrade to 2.8.8. What i have to do for that exactly?

import java.lang.reflect.Method;
import java.util.concurrent.CompletableFuture;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import play.Application;
import play.GlobalSettings;
import play.libs.F.Promise;
import play.mvc.Action;
import play.mvc.Http.Request;
import play.mvc.Http.RequestHeader;
import play.mvc.Result;


public class Global extends GlobalSettings {
    
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public void onStart(Application app) {
        logger.info("Application has started");

    }

    @Override
    public void onStop(Application app) {
        // Globals.profile.saveMap();
        logger.info("Application shutdown...");
    }

    public CompletableFuture<Result> onHandlerNotFound(RequestHeader request) {
        //return CompletableFuture.<Result> push(notFound("Action not found " + request.uri()));
        return null;
    }

    @SuppressWarnings("rawtypes")
    public Action onRequest(Request request, Method actionMethod) {
        logger.debug("\n" + request.toString() + "\n\t" + mapToString(request.headers()) + "\n\t"
                + request.body().toString());
        return super.onRequest(request, actionMethod);
    }

}

You should upgrade step by step, form 2.3 to 2.4 to 2.5… and read the migration guide for each release! You will have a lot of problems by upgrading Play 2.3 to 2.8 directly.
Globalsettings were deprecated in Play 2.4, see Migration24 - 2.8.x and its subpage Global Settings - 2.8.x
Again, please read the docs.

1 Like