2017-09-17 104 views

回答

0

是的,看看GitHub上的示例存儲庫中的Vert.x with Spring部分。

+0

我看起來更像是整合vert.x而不需要創建另一個類。但是你的解決方案也適用。謝謝你的幫助。 – heartly4u

0

在春季啓動是相當簡單的

@SpringBootApplication 
@ComponentScan(basePackages = { "com.mypackage", "com.myotherpackage" }) 
public class MyApplication { 

    @Autowired 
    private MainVerticle mainVertical; 

    public static void main(String[] args) throws Exception { 
     new SpringApplication(MyApplication.class).run(args); 
    } 

    @PostConstruct 
    public void deployServerVerticle() { 
     Vertx.vertx().deployVerticle(mainVertical); 
    } 

} 

@PostConstuct允許您部署所有你想要的(所有屬性都在此時進行設置)的垂直。

不言而喻,MainVerticle應該標記爲@Component註釋。

相關問題