Skip to content

Add H2 in-memory database to fix CI application context crash - #5

Merged
wonder37-debug merged 2 commits into
mainfrom
dev
Apr 13, 2026
Merged

Add H2 in-memory database to fix CI application context crash#5
wonder37-debug merged 2 commits into
mainfrom
dev

Conversation

@wonder37-debug

Copy link
Copy Markdown
Owner

This pull request primarily makes improvements to the backend/pom.xml build configuration and updates the test setup for the backend application. The most significant update is the addition of the H2 in-memory database as a test dependency, which will make it easier to run tests without needing a real database connection. There are also several formatting changes to simplify the XML structure, and the test configuration is updated to use the default Spring Boot context.

Dependency and test infrastructure improvements:

  • Added the com.h2database:h2 dependency with test scope to enable in-memory database testing, making backend tests more reliable and independent of external resources.
  • Updated BackendApplicationTests to use the default @SpringBootTest annotation, removing the exclusion of DataSourceAutoConfiguration, which allows tests to use the H2 database included above.

Build file formatting and simplification:

  • Simplified and compacted XML elements in pom.xml for licenses, developers, SCM, and plugin goals to improve readability and maintainability. [1] [2] [3]
  • Removed unnecessary whitespace and blank lines to keep the build file concise. [1] [2]

Copilot AI review requested due to automatic review settings April 13, 2026 09:07
@wonder37-debug
wonder37-debug merged commit 5b0d898 into main Apr 13, 2026
8 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the backend test/build setup so Spring Boot tests can start an application context with an in-memory database (H2), avoiding failures caused by missing external DB configuration in CI.

Changes:

  • Added com.h2database:h2 as a test-scoped dependency in backend/pom.xml.
  • Updated BackendApplicationTests to use the default @SpringBootTest configuration (no longer excluding DataSourceAutoConfiguration).
  • Minor pom.xml XML formatting/whitespace simplifications.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
backend/pom.xml Adds H2 (test scope) and applies minor XML formatting changes to support DB-backed test context initialization.
backend/src/test/java/com/campushub/backend/BackendApplicationTests.java Enables default Spring Boot context loading so tests can exercise the H2-backed DataSource auto-configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants