public class Sandbox {
public static void main(String[] args){
CompletableFuture<Void> future = new CompletableFuture<>();
JsonObject config = new JsonObject().put("guice_binder", SimpleModule.class.getName());
Vertx.vertx().deployVerticle("java-guice:" + SimpleVericle.class.getName(), new DeploymentOptions().setConfig(config).setInstances(2), result -> {
if (result.succeeded()) {
future.complete(null);
} else {
result.cause().printStackTrace();
future.completeExceptionally(result.cause());
}
});
}
}
public class SimpleModule extends AbstractModule{
@Override
protected void configure() {
bind(ThreadSafeSingleton.class).asEagerSingleton();
}
}
public class SimpleVericle extends AbstractVerticle {
@Inject ThreadSafeSingleton threadSafeSingleton;
@Override
public void start() throws Exception {
System.out.println("look another instance "+threadSafeSingleton.toString());
}
}
public class ThreadSafeSingleton {
}--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/13c2ac61-1b28-488e-a5d3-c004d77cad97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
new SimpleVerticle().start();
new SimpleVerticle().start();
class DBModule extends AbstractModule {
DBModule(Config config) {
// do something
}
@Override
protected void configure() {
//
}
}
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/ac224d90-ba50-4b9e-8835-a8ac3bbebeb3%40googlegroups.com.
Hello Thomas SEGISMONTI'm wondering what lib is a part of vertx-stack considering DI?
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/a61bcd1f-c611-4e5c-874e-1a89b072e953%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/CACiEr_SndPhBbu2EoiRONv9bpzsxoG5AE%2ByNr_7e%2BSaRrjdGyw%40mail.gmail.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/CAP3foKJPLJrQPf26ZKDKZjgQBySk6fE7vDXwzumYOU0Pp6Eu1Q%40mail.gmail.com.