简体   繁体   中英

How to boot up 2 spring boot application in one test?

I have two spring boot applications (REST services) that should run on different ports.

I want to combine them together in one integration test. For one application, it looks like:

@SpringApplicationConfiguration(classes = FirstApplication.class)
@WebIntegrationTest({"server.port=8080", "management.port=0"})

They are totally different. How could they be started in one method?

Did you try to set it in your application.properties file or yaml? Something like

server.port=${port:8080}

I think that you'll find more info here:

https://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM