Jooby 2.x is a significant rewrite. The major breaking change is that there is no more Servlet support, which is a blocker for us.
Here are my notes from a quick investigation.
org.jooby.Result and org.jooby.Results are gone, the new io.jooby.Context should be used instead.
@Singleton
@Path("/something")
public class SomethingResource {
@GET
public Result getSomething(final Optional<String> maybeSomething) {
return Results.ok(...);
}
}
becomes
@Singleton
@Path("/something")
public class SomethingResource {
@GET
public void getSomething(final Optional<String> maybeSomething, final Context context) {
context.setResponseCode(StatusCode.OK);
}
}
Jooby#use(config) has been removed: instead, we need to create a new environment (https://jooby.io/#configuration-custom-environment). Maybe something like that (untested):
public PluginApp build() {
final PluginApp app = new PluginApp(jackson, services, routeClasses);
final Environment origEnv = app.getEnvironment();
final Environment newEnv = new Environment(origEnv.getClassLoader(),
this.config.withFallback(origEnv.getConfig()),
origEnv.getActiveNames());
app.setEnvironment(newEnv);
return app;
}
org.jooby.Sse has become io.jooby.ServerSentEmitter
org.jooby.mvc.Local has become io.jooby.annotations.ContextParam
- There is no injection framework in 2.x. Guice has been replaced with a simple hash map service registry. Extra work is needed to integrate Guice again: https://jooby.io/#dependency-injection-guice
As part of the upgrade, we should add a few tests (https://jooby.io/#testing) in our base framework, to help with such upgrades in the future.
Jooby 2.x is a significant rewrite. The major breaking change is that there is no more Servlet support, which is a blocker for us.
Here are my notes from a quick investigation.
org.jooby.Resultandorg.jooby.Resultsare gone, the newio.jooby.Contextshould be used instead.becomes
Jooby#use(config)has been removed: instead, we need to create a new environment (https://jooby.io/#configuration-custom-environment). Maybe something like that (untested):org.jooby.Ssehas becomeio.jooby.ServerSentEmitterorg.jooby.mvc.Localhas becomeio.jooby.annotations.ContextParamAs part of the upgrade, we should add a few tests (https://jooby.io/#testing) in our base framework, to help with such upgrades in the future.