Java servlet application with PostgreSQL database support.
The easiest way to run this application is using Docker Compose:
- Docker and Docker Compose installed
- Maven (for building)
- Clone the repository:
git clone https://github.com/OKaluzny/servletApp.git
cd servletApp
- Build and run with Docker:
# Linux/Mac
./docker-build.sh
# Windows
docker-build.bat
- Access the application:
- Web Application: http://localhost:8080/demo
- WildFly Admin Console: http://localhost:9990 (admin/admin)
- PostgreSQL: localhost:5432 (postgres/postgres)
# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild and restart
docker-compose up --build -d
To run this application manually, you need to:
- Fork this project (preferred) or clone the repository
git clone https://github.com/OKaluzny/servletApp.git
- Build this application using Maven
mvn clean install -Dmaven.plugin.validation=VERBOSE
- Download and install WildFly from https://www.wildfly.org/. Start WildFly by going to the /bin directory and running standalone, then deploy the application using the command:
mvn org.wildfly.plugins:wildfly-maven-plugin:4.2.0.Final:deploy
-
Download and install Postman REST client
-
Download and install PostgreSQL database, create the Employee database:
DROP DATABASE IF EXISTS Employee;
CREATE DATABASE Employee;
\c Employee;
CREATE TABLE IF NOT EXISTS public.users
(
id SERIAL PRIMARY KEY,
name VARCHAR(255),
email VARCHAR(255),
country VARCHAR(255)
);
To enable SQL code assistance and eliminate IDE warnings about missing data sources, configure your IDE to connect to the PostgreSQL database:
Note: If you see warnings like "No data sources are configured to run this SQL and provide advanced code assistance" in your IDE, follow the configuration steps below to resolve them.
-
Using Docker (Recommended):
- Start the application with Docker:
./docker-build.sh
ordocker-build.bat
- In IntelliJ IDEA, go to View → Tool Windows → Database
- Click the + button and select Data Source → PostgreSQL
- Configure the connection:
- Host:
localhost
- Port:
5432
- Database:
employee
- User:
postgres
- Password:
postgres
- Host:
- Test the connection and apply
- Start the application with Docker:
-
Manual PostgreSQL Setup:
- Install PostgreSQL locally
- Create the database using the SQL commands above
- Configure the data source with your local PostgreSQL credentials
For other IDEs (Eclipse, VS Code, etc.), configure a PostgreSQL connection using:
- JDBC URL:
jdbc:postgresql://localhost:5432/employee
- Username:
postgres
- Password:
postgres
Once configured, your IDE will provide SQL syntax highlighting, code completion, and validation for database queries.