Guice Integration for Vert.x


Лицензия

Лицензия

Категории

Категории

GUI Взаимодействие с пользователем Guice Библиотеки уровня приложения Dependency Injection
Группа

Группа

com.goodow.vertx
Идентификатор

Идентификатор

vertx-mod-guice
Последняя версия

Последняя версия

4.0-beta5
Дата

Дата

Тип

Тип

jar
Описание

Описание

Guice Integration for Vert.x
Guice Integration for Vert.x
Ссылка на сайт

Ссылка на сайт

https://github.com/larrytin/vertx-mod-guice
Система контроля версий

Система контроля версий

https://github.com/larrytin/vertx-mod-guice

Скачать vertx-mod-guice

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.goodow.vertx/vertx-mod-guice/ -->
<dependency>
    <groupId>com.goodow.vertx</groupId>
    <artifactId>vertx-mod-guice</artifactId>
    <version>4.0-beta5</version>
</dependency>
// https://jarcasting.com/artifacts/com.goodow.vertx/vertx-mod-guice/
implementation 'com.goodow.vertx:vertx-mod-guice:4.0-beta5'
// https://jarcasting.com/artifacts/com.goodow.vertx/vertx-mod-guice/
implementation ("com.goodow.vertx:vertx-mod-guice:4.0-beta5")
'com.goodow.vertx:vertx-mod-guice:jar:4.0-beta5'
<dependency org="com.goodow.vertx" name="vertx-mod-guice" rev="4.0-beta5">
  <artifact name="vertx-mod-guice" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.goodow.vertx', module='vertx-mod-guice', version='4.0-beta5')
)
libraryDependencies += "com.goodow.vertx" % "vertx-mod-guice" % "4.0-beta5"
[com.goodow.vertx/vertx-mod-guice "4.0-beta5"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.google.inject : guice jar 4.0-beta5
com.google.inject.extensions : guice-multibindings jar 4.0-beta5
com.google.guava : guava jar 18.0

provided (2)

Идентификатор библиотеки Тип Версия
io.vertx : vertx-core jar 2.1.5
io.vertx : vertx-platform jar 2.1.5

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
io.vertx : testtools jar 2.0.3-final

Модули Проекта

Данный проект не имеет модулей.

vertx-mod-guice README Build Status

vertx-mod-guice is a Google Guice module for Vert.x. It includes everything you need to be Guicing your Vert.x like a pro in five minutes.

The easy tutorial

First, create a Guice Module that implements VertxModule

public class MyModule implements VertxModule {

    private Container container;
    private Vertx vertx;

    @Override
    public void configure(Binder binder) {
		///Do binding stuff here!
		binder.bind(MyService.class).to(MyServiceImpl.class);
    }

    @Override
    public void setContainer(Container container) {
        this.container = container;
    }

    @Override
    public void setVertx(Vertx vertx) {
        this.vertx = vertx;
    }
}

Next create your Verticle, extending GuiceVerticle. Using the @GuiceVertxBinding annotation, supply a list of all the Modules the verticle needs at runtime. Use the @Inject annotation to inject any dependencies defined in the modules. You should @Override the onStart() method to kick off any of your normal verticle activity.

@GuiceVertxBinding(modules = {MyModule.class})
public class MyVerticle extends GuiceVerticle {

    @Inject
    MyService myService;

    @Override
    public void onStart() {
       	myService.doStuff();
    }
}

Make sure that you include the name of the module in your mod.json for any module that needs to use vertx-mod-guice.

com.goodow.vertx~vertx-mod-guice~4.0-beta5

But wait, my Verticles already inherit from some other class!

Not a problem, here is an example for that case.

@GuiceVertxBinding(modules = {MyModule.class})
public class RawVerticle extends Verticle {

    @Inject
    MyService myService;

    @Override
    public void start() {
    	//Just call this firt from the start method
        GuiceVerticleHelper.inject(this, vertx, container);

		//Proceed as normal
		myService.doStuff();
    }
}

Версии библиотеки

Версия
4.0-beta5
1.0.0-beta4