No description
| .junie | ||
| gradle/wrapper | ||
| src/main | ||
| .gitignore | ||
| build.gradle | ||
| gradlew | ||
| gradlew.bat | ||
| README.md | ||
| settings.gradle | ||
Minimal Micronaut Application
This is a minimal Micronaut application (version 4.9.0) with server-side rendering using Pebble templates and H2 database integration.
Features
- Micronaut 4.9.0
- Server-side rendering with Pebble template engine
- H2 in-memory database
- Simple book library example
Requirements
- Java 21 or higher
- Gradle 8.14.2 or higher
Running the Application
To run the application, execute:
./gradlew run
The application will start on port 8080.
Accessing the Application
Open your browser and navigate to:
http://localhost:8080/books
This will display a list of books stored in the H2 database.
Project Structure
src/main/java/com/example/Application.java- Main application classsrc/main/java/com/example/controller/BookController.java- Controller for handling HTTP requestssrc/main/java/com/example/model/Book.java- Entity class for bookssrc/main/java/com/example/repository/BookRepository.java- Repository interface for database operationssrc/main/resources/views/books.peb- Pebble template for rendering the book listsrc/main/resources/application.yml- Application configurationsrc/main/resources/logback.xml- Logging configuration
Database
The application uses an H2 in-memory database that is initialized with sample data when the application starts.