The Spring Boot guide says I can get the H2 console but it's not working for me.
http://localhost:8080/h2/ Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed Oct 26 12:31:46 BST 2016 There was an unexpected error (type=Not Found, status=404). No message available
I created an application.properties
file as follows
spring.h2.console.enabled=true
spring.h2.console.path=/h2
My project is based on this
The default path /h2-console
doesn't work either.
I found another answer where the problem is solved by adding to Application.java
:
@Bean
public ServletRegistrationBean h2servletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new WebServlet());
registration.addUrlMappings("/h2/*");
return registration;
}
Everything in my application.properties
file is ignored. I have tried adding:
spring.datasource.url=jdbc:h2:file:~/portal;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver
But the database is still created in memory only.
application.properties
located and which spring boot version are you using. – Nobukonobyjavaworkspace\gs-accessing-data-rest-initial\src\main\java\hello\application.properties
andorg.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE
– Wrotesrc\main\resources
... Next to that it must be in te root and not a sub package. – Nobukonoby