Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 23 16:37
    maxpert commented #2436
  • Oct 23 16:36
    maxpert commented #2436
  • Oct 22 11:59
    jknack commented #2447
  • Oct 22 02:16
    nikolaosinlight commented #2447
  • Oct 22 02:16
    nikolaosinlight commented #2447
  • Oct 22 02:15
    nikolaosinlight commented #2447
  • Oct 22 02:14
    nikolaosinlight commented #2447
  • Oct 21 07:25
    nikolaosinlight commented #2447
  • Oct 20 14:34
    jknack commented #2447
  • Oct 20 14:25
    nikolaosinlight commented #2447
  • Oct 20 14:25
    nikolaosinlight commented #2447
  • Oct 20 12:57
    jknack labeled #2447
  • Oct 20 12:57
    jknack labeled #2447
  • Oct 20 12:05
    jknack commented #2447
  • Oct 20 07:09
    nikolaosinlight edited #2447
  • Oct 20 07:08
    nikolaosinlight opened #2447
  • Oct 20 06:54
    nikolaosinlight commented #2446
  • Oct 20 06:52
    nikolaosinlight commented #2446
  • Oct 20 06:50
    nikolaosinlight commented #2446
  • Oct 19 19:07
    agentgt commented #2446
Nguyen Huu Tuan
@snowyukischnee

@jknack
if i define the routes and mount it using mount(), then this will not works, it throws io.jooby.exception.RegistryException: Service not found

class RouterDef extends Jooby {
  {
    mvc(Router.class);
  }
}
{
  install(new GuiceModule());
  mount(new RouterDef());
}

but this works

  {
    install(new GuiceModule());
    mvc(Router.class);
  }
Nguyen Huu Tuan
@snowyukischnee
does di was not work under mount() ?
Nguyen Huu Tuan
@snowyukischnee
and, how can i use guice injection with decorator?
Pascal Le Merrer
@PascalLeMerrer
Hi. I'm new to Jooby, it looks very promising. The home page content however looks like it was spammed with links without interest.
Mészáros István
@imeszaros
@PascalLeMerrer use https://jooby.io/ instead of jooby.org.
the latter was taken over by a stranger and Edgar was unable to get it back from the provider unfortunately
If you need the docs for Jooby v1.x: https://jooby.io/v1
Pascal Le Merrer
@PascalLeMerrer
Thanks @imeszaros!
Edgar Espina
@jknack
Hi @snowyukischnee, please provide a complete example + stacktrace
Nguyen Huu Tuan
@snowyukischnee

@jknack here is my main app

{
        install(new GuiceModule(
                new DatabaseRepositoryDI(),
                new DomainServiceDI()
        ));
        // database
        final String dbName = "datasource.expr";
        install(new HikariModule(dbName));
        install(new HibernateModule(dbName).scan("com.package.entities"));
        // default error handler
        error(new DefaultHttpErrorHandler());
        // route definitions
        mvc(CustomerRouter.class); // works here
        mount(new RouteDef());
    }

here is RouteDef class

{
        before(ctx -> ctx.setResponseType(MediaType.json));
        path("/customer", () -> {
            mvc(CustomerRouter.class);
        });
    }
@Slf4j
@Singleton
@Tag(name = "Customer")
public class CustomerRouter {
        @Inject
        private MyService myService;

        @Path("/test")
        @GET
        public Object test(Context ctx) throws Exception {
                System.out.println(myService);
                return 1;
        }
}
it throws io.jooby.exception.RegistryException: Service not found if I request to /customer/test, If I request to /test only then it works
also inside DomainServiceDI class
public class DomainServiceDI extends AbstractModule {
    @Override
    protected void configure() {
        bind(MyService.class).to(MyServiceImpl.class).in(Singleton.class);
    }
}
Pascal Le Merrer
@PascalLeMerrer

Hello. I created a basic project with the Console using "create --gradle -k --server=jetty --docker --openapi io.timiiz:server:0.0.1". When I follow the instructions and type ./gradlew joobyRun, it says it cannot find org.gradle.wrapper.GradleWrapperMain. I verified, gradle/wrapper/gradle-wrapper.jar is present. When running gradle without the wrapper, I 've several build errors :

gradle build

Task :compileTestKotlin FAILED
w: Classpath entry points to a non-existent location: /Users/peal6230/Documents/dev/projects/timiiz/io.timiiz
w: Classpath entry points to a non-existent location: server
w: Classpath entry points to a non-existent location: 0.0.1/build/classes/kotlin/main
e: /Users/peal6230/Documents/dev/projects/timiiz/io.timiiz:server:0.0.1/src/test/kotlin/io/timiiz/IntegrationTest.kt: (11, 12): Unresolved reference: App
e: /Users/peal6230/Documents/dev/projects/timiiz/io.timiiz:server:0.0.1/src/test/kotlin/io/timiiz/IntegrationTest.kt: (11, 12): An annotation argument must be a compile-time constant
e: /Users/peal6230/Documents/dev/projects/timiiz/io.timiiz:server:0.0.1/src/test/kotlin/io/timiiz/UnitTest.kt: (12, 29): Unresolved reference: App

I published the project at https://github.com/PascalLeMerrer/jooby-test.

Edgar Espina
@jknack
looks like a bug in the generator
delete/remove the test directory: /Users/peal6230/Documents/dev/projects/timiiz/io.timiiz:server:0.0.1/src/test
hmm also
not sure about the : in project folder
io.timiiz:server:0.0.1
Pascal Le Merrer
@PascalLeMerrer
the project folder is named like this because I understood the generator said the name parameter should be "Application name or coordinates (groupId:artifactId:version)". I was surprised it used this for naming the folder.
Edgar Espina
@jknack
yea think it is another bug
Pascal Le Merrer
@PascalLeMerrer
It's much better when renaming the folder to something more conventional :)
Edgar Espina
@jknack
yea sorry
Pascal Le Merrer
@PascalLeMerrer
no problem, it's very kind of you to develop this project and make it open source
Edgar Espina
@jknack
thank you!
Pascal Le Merrer
@PascalLeMerrer
and to answer so quickly to my question!
Nguyen Huu Tuan
@snowyukischnee
hi @jknack, can you help me this
Daniel Sokil
@s0kil
Are there any plans to also provide first class Scala support?
Edgar Espina
@jknack
Hi Daniel, no plans at all
Edgar Espina
@jknack
Hashim Sayyid
@Sayyiditow

hi @jknack is it possible to configure the error handler on another class that extends jooby, then mount it to the main class?
Something similar to how mvc, websocket routes work. So you can initialize all routes using a separate class that extends jooby (not main), then in the main class which also extends jooby, just do mount(class that changes with mvc controllers).

Trying to keep the main class minimal and unchanging all the time.

--Edit, websocket also works with mount. Couldn't get error handlers to work.

Mészáros István
@imeszaros
@Sayyiditow i think this is an upcoming feature: jooby-project/jooby#1905
SabrinaKall
@SabrinaKall
hi @jknack , we're having some trouble with kotlin, jooby (v1.6.8, I know, I'm sorry) and swagger: Results.noContent() is being interpreted as a return type Result with status code 200, instead of 204 as expected. We're already using the ApiTool to modify some descriptions, is there a way to correct the indicated status codes as well?
Hashim Sayyid
@Sayyiditow

@Sayyiditow i think this is an upcoming feature: jooby-project/jooby#1905

cool thanks.

Edgar Espina
@jknack
Adam Gent
@agentgt
The OpenAPI module is impressive but kind of scary and brittle. We were originally using a custom compile time annotation processor that has grown stale so I was investigating Jooby's OpenAPI. The problem with the ASM parsing openapi is it seems really really complicated and you basically have to construct a Jooby subclass in a very specific way.
For example inheritance is not supported.
Doing dynamic stuff with the contextPath is also
However I don't really have a better solution and I like I said before the ASM parsing very impressive.
If Jooby only had the JAXRS annotations I would vastly prefer a plain jane Java APT with some bare minimum for POJO schema detection ASM stuff.
That is the other problem with the openapi implementation. It requires a maven plugin. An APT does not.
Adam Gent
@agentgt
Anyway my current solution for our code base right now is to make a subclass Jooby called FakeJooby that then mvc installs all of our controllers and then give the maven plugin that class instead of our real Jooby.
Adam Gent
@agentgt
I wonder how many folks are making APIs with script API vs the MVC/JAXRS API
It seems like if you are doing an the microservice you have to annotate anyway so you might as well do the MVC style
Adam Gent
@agentgt
Oh besides inheritance and dynamic contextPath obviously adding scripts/mvc after the jooby object is instantiated doesn't work either.
I wouldn't be surprised if multiple constructors and/or constructors that take arguments doesn't work Amazingly it works and now that I think about it makes since it just looking for mvc calls
Adam Gent
@agentgt
Also you can't name your "application" class Jooby anything because the OpenAPI module does a replace("Jooby") on the name
so MyJooby for example as a classname would fail because it would become Myopenapi.json
That is probably abug
Hashim Sayyid
@Sayyiditow

@Sayyiditow Try with: https://jooby.io/#router-composing-install

Thanks!