Closed jknack closed 4 months ago
my.pkg.Controller_
MvcExtension
mvc(new Controller_());
mvc
mvc(new Controller()_)
Example:
package tests; import io.jooby.Context; import io.jooby.Extension; import io.jooby.Jooby; import io.jooby.MvcExtension; import io.jooby.MvcFactory; import io.jooby.annotation.Generated; import jakarta.inject.Provider; import java.lang.Class; import java.lang.Exception; import java.lang.String; import java.util.function.Function; @Generated("tests.CustomRouterName") public class CustomRouterName_ implements MvcExtension, MvcFactory { protected final Function<Context, CustomRouterName> provider; public CustomRouterName_(CustomRouterName instance) { this.provider = ctx -> instance; } public CustomRouterName_(Provider<CustomRouterName> supplier) { this.provider = ctx -> supplier.get(); } public CustomRouterName_(Class<CustomRouterName> type) { this.provider = ctx -> ctx.require(CustomRouterName.class); } public CustomRouterName_() { this(new CustomRouterName()); } public void install(Jooby app) throws Exception { /** See {@link CustomRouterName#hello(java.lang.String) */ app.get("/hello", this::hello) .setReturnType(java.lang.String.class) .setMvcMethod(CustomRouterName.class.getMethod("hello", java.lang.String.class)); } public String hello(Context ctx) throws Exception { return this.provider.apply(ctx).hello(ctx.query("name").valueOrNull()); } public boolean supports(Class type) { return type == CustomRouterName.class; } public Extension create(Provider provider) { return new CustomRouterName_(provider); } }
cc @agentgt @SentryMan
my.pkg.Controller_
MvcExtension
mvc(new Controller_());
mvc
method support based on Service Locator pattern, but then are now deprecated and must be migrated to new mvc method.mvc(new Controller()_)
look upExample: