Spring Boot & H2 - Console



As in previous chapter Application Setup, we've created the required files in spring boot project. Now let's update the application.properties lying in src/main/resources and pom.xml to use a different version of maven-resources-plugin.

application.properties

spring.datasource.url=jdbc:h2:mem:testdb

pom.xml

...
<build>
   <plugins>
      <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
      </plugin>
   </plugins>
</build>
...

Run the application

In eclipse, run the Employee Application configuration as prepared during Application Setup

Eclipse console will show the similar output.

[INFO] Scanning for projects...
[INFO] 
[INFO] [1m------------------< [0;36mcom.tutorialspoint:springboot-h2[0;1m >------------------[m
[INFO] [1mBuilding springboot-h2 0.0.1-SNAPSHOT[m
[INFO]   from pom.xml
[INFO] [1m--------------------------------[ jar ]---------------------------------[m
[INFO] 
[INFO] [1m>>> [0;32mspring-boot:3.5.6:run[m [1m(default-cli)[0;1m > [0;1mtest-compile[m @ [36mspringboot-h2[0;1m >>>[m
[INFO] 
[INFO] [1m--- [0;32mresources:3.3.1:resources[m [1m(default-resources)[m @ [36mspringboot-h2[0;1m ---[m
[INFO] Copying 1 resource from src\main\resources to target\classes
[INFO] Copying 0 resource from src\main\resources to target\classes
[INFO] 
[INFO] [1m--- [0;32mcompiler:3.14.0:compile[m [1m(default-compile)[m @ [36mspringboot-h2[0;1m ---[m
[INFO] Recompiling the module because of [1madded or removed source files[m.
[INFO] Compiling 5 source files with javac [debug parameters release 21] to target\classes
[INFO] 
[INFO] [1m--- [0;32mresources:3.3.1:testResources[m [1m(default-testResources)[m @ [36mspringboot-h2[0;1m ---[m
[INFO] skip non existing resourceDirectory D:\Projects\springboot-h2\src\test\resources
[INFO] 
[INFO] [1m--- [0;32mcompiler:3.14.0:testCompile[m [1m(default-testCompile)[m @ [36mspringboot-h2[0;1m ---[m
[INFO] Recompiling the module because of [1mchanged dependency[m.
[INFO] Compiling 1 source file with javac [debug parameters release 21] to target\test-classes
[INFO] 
[INFO] [1m<<< [0;32mspring-boot:3.5.6:run[m [1m(default-cli)[0;1m < [0;1mtest-compile[m @ [36mspringboot-h2[0;1m <<<[m
[INFO] 
[INFO] 
[INFO] [1m--- [0;32mspring-boot:3.5.6:run[m [1m(default-cli)[m @ [36mspringboot-h2[0;1m ---[m
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.5.6)

2025-10-01T16:10:51.809+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] c.t.s.SpringbootH2Application            : Starting SpringbootH2Application using Java 21.0.6 with PID 35360 (D:\Projects\springboot-h2\target\classes started by mahes in D:\Projects\springboot-h2)
2025-10-01T16:10:51.811+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] c.t.s.SpringbootH2Application            : No active profile set, falling back to 1 default profile: "default"
2025-10-01T16:10:51.891+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2025-10-01T16:10:51.891+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2025-10-01T16:10:52.272+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2025-10-01T16:10:52.305+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 24 ms. Found 1 JPA repository interface.
2025-10-01T16:10:52.818+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2025-10-01T16:10:52.832+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2025-10-01T16:10:52.832+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.46]
2025-10-01T16:10:52.876+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2025-10-01T16:10:52.877+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 984 ms
2025-10-01T16:10:52.991+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2025-10-01T16:10:53.183+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:testdb user=SA
2025-10-01T16:10:53.185+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2025-10-01T16:10:53.227+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2025-10-01T16:10:53.281+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 6.6.29.Final
2025-10-01T16:10:53.319+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.h.c.internal.RegionFactoryInitiator    : HHH000026: Second-level cache disabled
2025-10-01T16:10:53.554+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.s.o.j.p.SpringPersistenceUnitInfo      : No LoadTimeWeaver setup: ignoring JPA class transformer
2025-10-01T16:10:53.641+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] org.hibernate.orm.connections.pooling    : HHH10001005: Database info:
	Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)']
	Database driver: undefined/unknown
	Database version: 2.3.232
	Autocommit mode: undefined/unknown
	Isolation level: undefined/unknown
	Minimum pool size: undefined/unknown
	Maximum pool size: undefined/unknown
2025-10-01T16:10:54.259+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
2025-10-01T16:10:54.285+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2025-10-01T16:10:54.432+05:30  WARN 35360 --- [springboot-h2] [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2025-10-01T16:10:54.606+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration    : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:testdb'
2025-10-01T16:10:54.658+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2025-10-01T16:10:54.692+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path '/'
2025-10-01T16:10:54.700+05:30  INFO 35360 --- [springboot-h2] [  restartedMain] c.t.s.SpringbootH2Application            : Started SpringbootH2Application in 3.193 seconds (process running for 3.488)

Once server is up and running, open localhost:8080/h2-console in a browser and click on Test Connection to verify the database connection.

h2 Console Login

Click on Connect button and H2 database window will appear as shown below −

h2 console
Advertisements