Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@

package io.vertx.examples.spring.verticlefactory;

import java.util.Map;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Vertx;
import io.vertx.core.spi.VerticleFactory;

import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
Expand All @@ -43,7 +48,9 @@ public static void main(String[] args) {

// Scale the verticles on cores: create 4 instances during the deployment
DeploymentOptions options = new DeploymentOptions().setInstances(4);
vertx.deployVerticle(verticleFactory.prefix() + ":" + GreetingVerticle.class.getName(), options);
Map<String, AbstractVerticle> verticleBeans = context.getBeansOfType(AbstractVerticle.class);
verticleBeans.forEach((beanName, bean) -> {
vertx.deployVerticle(verticleFactory.prefix() + ":" + AopProxyUtils.ultimateTargetClass(bean).getName(), options);
});
}

}