Closed tnguyen-lh closed 6 years ago
The "problem" is you are using a Guice specific @Inject annotation instead of the standard javax.inject.Inject annotation.
Guice provides it's own set of JAX-RS annotations but rest.vertx uses javax.inject annotations.
Just change
import com.google.inject.Inject;
to
import javax.inject.Inject;
and it will work.
Will try to provide a more comprehensive error message to prevent additional confusion.
I follow the instruction in "Injection" section, but got exception, the same exception happened in your example project.
java.lang.IllegalArgumentException: Failed to instantiate class of type: com.sc.application.rest.TestRest3, class needs empty constructor!
pom.xml
Starting App get exception
SEVERE: Failed in deploying verticle java.lang.IllegalArgumentException: Failed to instantiate class of type: com.sc.application.rest.TestRest3, class needs empty constructor! at com.zandero.rest.RestRouter.register(RestRouter.java:118) at com.zandero.rest.RestRouter.register(RestRouter.java:80) at com.zandero.rest.RestBuilder.getRouter(RestBuilder.java:328) at com.zandero.rest.RestBuilder.build(RestBuilder.java:360) at com.sc.application.rest.App.start(App.java:70) at io.vertx.core.AbstractVerticle.start(AbstractVerticle.java:106) at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:483) at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)