CCCPaste

3dcd2db17987e

package spring;

import io.vertx.core.Vertx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.EventListener;
import spring.verticles.ProxyVerticle;

@SpringBootApplication
public class VertxSpringApplication {

    @Autowired
    private ProxyVerticle proxyVerticle;

    public static void main(String[] args) {
        SpringApplication.run(VertxSpringApplication.class, args);
    }

    @Bean
    public Vertx vertx() {
        return Vertx.vertx();
    }

    @EventListener
    public void deployVerticle(ApplicationReadyEvent event) {
        final Vertx vertx = this.vertx();
        vertx.deployVerticle(proxyVerticle);
    }
}