ServletsPOC is a Java-based web application that demonstrates the use of Servlets, Hibernate, and a PostgreSQL database for managing user data. The application provides CRUD (Create, Read, Update, Delete) operations for users through RESTful endpoints.
- User Management: Create, read, update, and delete user records.
- Validation: Input validation using Jakarta Bean Validation.
- JSON Support: Uses Jackson for JSON serialization and deserialization.
- Logging: Configurable logging for debugging and monitoring.
- Java: Core programming language.
- Jakarta Servlet API: For handling HTTP requests and responses.
- PostgreSQL: Relational database for storing user data.
- Jackson: For JSON processing.
- Maven: Build and dependency management tool.
- Docker: For containerizing the application and database.
- Java 17 or higher
- Maven 3.8 or higher
- Docker and Docker Compose
- PostgreSQL (if not using Docker)
git clone https://github.com/renatompf/java_servlets_poc.git
cd java_servlets_pocdocker-compose up- Ensure PostgreSQL is running and create a database named
servletspoc. - Deploy the WAR file to a Tomcat server.
- Access the application at
http://localhost:8080/users.
| HTTP Method | Endpoint | Description |
|---|---|---|
| GET | /users |
Fetch all users |
| GET | /users/{id} |
Fetch a user by ID |
| POST | /users |
Create a new user |
| PUT | /users/{id} |
Update an existing user |
| DELETE | /users/{id} |
Delete a user by ID |
(If using BRUNO you can find the request and response examples in the http directory .)
{
"name": "Larry Page",
"email": "larry@gmail.com",
"country": "USA"
}{
"name": "Larry Page",
"email": "larry.page@gmail.com",
"country": "USA"
}