Reputation: 7088
I'm working with Spring Boot 1.3.1.RELEASE
. I enabled the H2 web console by setting spring.h2.console.enabled=true
in the application.properties
file. If I launch my Spring Boot application I can access the H2 Web console via http://localhost:8080/h2-console/
.
However, I am not able to access the console when I perform an integration test in debug mode, where I have set a breakpoint. Unfortunately, this is not working (site is not available). The integration test is configured as follows:
@ActiveProfiles("local,unittest")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MyApplication.class)
@WebAppConfiguration
@IntegrationTest
public class MyResourceTest {
What I have not considered?
Upvotes: 9
Views: 7479
Reputation: 1759
To enable the H2 Web console, you should agregate the value of your properties file related to this item as optional element of the annotation @IntegrationTest
.
String[]value
Properties in form key=value
that should be added to the Spring Environment before the test runs.
Example:
@IntegrationTest({"spring.h2.console.enabled=true"})
And keep in mind this recomendation :
If your test also uses @WebAppConfiguration consider using the @WebIntegrationTest instead of @IntegrationTest
So, try to use @WebIntegrationTest
instead of @IntegrationTest
and add the key spring.h2.console.enabled = true
Maybe you could need add the key "server.port=8080" as another value for the annotation @WebIntegrationTest
Upvotes: 4