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

前端 未结 6 1915
忘了有多久
忘了有多久 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:12

    Had the same issue, you just have to make the management.port null by adding this in your application-test.properties (set it to empty value)

    management.port=
    

    Make sure you use the test profile in your JUnit by annotating the class with

    @ActiveProfiles("test")
    

提交回复
热议问题