Unit testing of Spring Boot Actuator endpoints not working when specifying a port

前端 未结 6 1877
忘了有多久
忘了有多久 2021-01-04 06:43

recently I changed my spring boot properties to define a management port. In doing so, my unit tests started to fail :(

I wrote a unit test that tested the /

6条回答
  •  孤街浪徒
    2021-01-04 07:22

    Did you try adding the following annotation to your test class?

    @TestPropertySource(properties = {"management.port=0"})
    

    Check the following link for reference.

提交回复
热议问题