diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..eadd1fc
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,43 @@
+# Common
+README.md
+CHANGELOG.md
+docker-compose.yml
+Dockerfile
+
+# Git folder #
+/.git/
+
+# Compilation folders #
+/bin/
+/target/
+/build/
+
+# Log files #
+/*.log
+/*.log.*
+
+# Eclipse files #
+.buildpath
+.classpath
+.cproject
+.externalToolBuilders/
+.launch
+.loadpath
+.metadata
+.project
+.settings/
+bin/**
+tmp/**
+tmp/**/*
+*.tmp
+*.nak
+*.swp
+*~.nib
+*.pydevproject
+local.properties
+/src/main/resources/rebel.xml
+.springBeans
+
+# IntelliJ Idea files #
+.idea
+*.iml
diff --git a/.github/workflows/doc_deployment.yml b/.github/workflows/doc_deployment.yml
deleted file mode 100644
index 02846d6..0000000
--- a/.github/workflows/doc_deployment.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: Doc deployment
-
-on:
- push:
- branches:
- - master
- - develop
-
-jobs:
- deploy_develop_docs:
- name: Deploy docs for develop
- uses: Bernardo-MG/github-workflow-maven/.github/workflows/deploy_site.yml@v1
- with:
- branch: develop
- host: docs.bernardomg.com
- jdk: 17
- secrets:
- url: ${{ secrets.DEPLOY_DOCS_DEVELOP_SITE }}
- username: ${{ secrets.DEPLOY_DOCS_DEVELOP_USER }}
- password: ${{ secrets.DEPLOY_DOCS_DEVELOP_PASSWORD }}
-
- deploy_master_docs:
- name: Deploy docs for master
- uses: Bernardo-MG/github-workflow-maven/.github/workflows/deploy_site.yml@v1
- with:
- branch: master
- host: docs.bernardomg.com
- jdk: 17
- secrets:
- url: ${{ secrets.DEPLOY_DOCS_SITE }}
- username: ${{ secrets.DEPLOY_DOCS_USER }}
- password: ${{ secrets.DEPLOY_DOCS_PASSWORD }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index f1dd7dd..67d2170 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -3,8 +3,24 @@ name: Tests
on: [push, pull_request]
jobs:
- tests_17:
- name: Tests with JDK 17
- uses: Bernardo-MG/github-workflow-maven/.github/workflows/testing.yml@v1
- with:
- jdk: 17
+ tests:
+ name: Tests with JDK ${{ matrix.jdk }}
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ jdk: [17, 21]
+
+ steps:
+ - name: Check-out
+ uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - name: Set up JDK ${{ matrix.jdk }}
+ uses: actions/setup-java@v4
+ with:
+ java-version: ${{ matrix.jdk }}
+ distribution: 'temurin'
+ cache: 'maven'
+ - name: Run up to integration tests
+ run: mvn verify -fae
diff --git a/.gitignore b/.gitignore
index 7aceced..3b01119 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@
# Log files #
/*.log
/*.log.*
+/logs/**
# Output folders #
/test-output/
@@ -48,6 +49,10 @@ local.properties
.idea
*.iml
+# Visual Studio #
+.vscode/
+.factorypath
+
# Windows files #
Thumbs.db
Desktop.ini
diff --git a/LICENSE b/LICENSE
index 9e6d16f..850d137 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2022-2023 Bernardo MartÃnez Garrido
+Copyright (c) 2022-2025 Bernardo MartÃnez Garrido
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..6e238e9
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,47 @@
+# -----------------------------------------------------------------------------
+# BUILD STAGE
+# -----------------------------------------------------------------------------
+FROM maven:3.9.9-eclipse-temurin-22-alpine as build
+
+# Create app directory
+WORKDIR /app
+
+# Resolve and cache dependencies
+COPY ./pom.xml .
+RUN mvn dependency:go-offline
+
+# Copy and build
+COPY ./src ./src
+RUN mvn --batch-mode clean package -DskipTests
+
+# -----------------------------------------------------------------------------
+# DEPLOYMENT STAGE
+# -----------------------------------------------------------------------------
+FROM eclipse-temurin:22-jre-alpine as deployment
+
+WORKDIR /app
+
+# Exposed ports
+EXPOSE 8080
+EXPOSE 8000
+
+# Health check
+HEALTHCHECK --interval=30s --retries=5 --timeout=10s CMD curl --fail --silent localhost:8080/actuator/health | grep UP || exit 1
+
+# Create runner user
+RUN addgroup -S runners && \
+ adduser --disabled-password -S runner -G runners
+
+# Add logs folder and assign to runner user
+RUN mkdir ./logs && \
+ chown runner ./logs
+VOLUME ./logs
+
+# Change to runner user
+USER runner
+
+# Copy from build stage
+COPY --from=build ./app/target/*.war ./app.war
+
+# Run with remote debugging
+CMD ["java", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000", "-jar", "app.war"]
\ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644
index 0000000..3386f49
--- /dev/null
+++ b/docker/docker-compose.yml
@@ -0,0 +1,47 @@
+version: '3'
+services:
+ basic-db:
+ image: postgres:15.0-alpine
+ environment:
+ PGUSER: 'postgres'
+ POSTGRES_DB: 'postgres'
+ POSTGRES_USER: 'postgres'
+ POSTGRES_PASSWORD: 'password'
+ ports:
+ - "5432:5432"
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready", "-U postgres"]
+ interval: 30s
+ timeout: 10s
+ retries: 5
+ networks:
+ - db
+ basic-ws:
+ build:
+ context: ../
+ dockerfile: ./docker/Dockerfile
+ ports:
+ - "8080:8080"
+ - "8000:8000"
+ depends_on:
+ basic-db:
+ condition: service_healthy
+ healthcheck:
+ test: "wget -T5 -qO- http://localhost:8080/actuator/health | grep UP || exit 1"
+ interval: 2s
+ timeout: 3s
+ retries: 5
+ start_period: 60s
+ environment:
+ # JDBC
+ - spring.datasource.url=jdbc:postgresql://basic-db:5432/postgres
+ - spring.datasource.username=postgres
+ - spring.datasource.password=password
+ volumes:
+ - basic-logs:/app/logs
+ networks:
+ - db
+volumes:
+ basic-logs:
+networks:
+ db:
diff --git a/pom.xml b/pom.xml
index 09550a9..0e9dcf3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
com.bernardomg.maven
base-pom
- 1.5.3
+ 1.5.7
@@ -21,7 +21,7 @@
com.bernardomg.example
spring-ws-basic-security-example
- 1.2.2
+ 1.3.0
war
Spring WS Basic Security Example
@@ -45,17 +45,17 @@
scm:git:https://github.com/bernardo-mg/spring-ws-basic-security-example.git
scm:git:https://github.com/bernardo-mg/spring-ws-basic-security-example.git
head
- https://www.github.com/bernardo-mg/spring-ws-basic-security-example
+ https://github.com/bernardo-mg/spring-ws-basic-security-example
GitHub
- https://www.github.com/bernardo-mg/spring-ws-basic-security-example/issues
+ https://github.com/bernardo-mg/spring-ws-basic-security-example/issues
Github
- https://www.github.com/bernardo-mg/spring-ws-basic-security-example/actions
+ https://github.com/bernardo-mg/spring-ws-basic-security-example/actions
@@ -123,9 +123,10 @@
- 3.0.5
- 6.0.8
- 1.10.6
+ 3.26.3
+ 0.1.5
+ 3.4.0
+ 6.2.0
@@ -135,6 +136,8 @@
${project.basedir}/src/config/checkstyle/checkstyle-rules.xml
+
+ 3.12.1
@@ -156,7 +159,7 @@
import
-
+
org.springframework.boot
spring-boot-dependencies
${spring.boot.version}
@@ -167,6 +170,15 @@
+
+
+
+
+
+ com.bernardomg.framework.spring
+ spring-ws-starter
+ ${bernardomg.framework.ws.version}
+
@@ -333,14 +345,6 @@
-
-
-
-
- com.h2database
- h2
-
-
@@ -374,7 +378,7 @@
org.apache.logging.log4j
- log4j-slf4j-impl
+ log4j-slf4j2-impl
@@ -385,6 +389,12 @@
org.apache.logging.log4j
log4j-jcl
+
+
+ commons-logging
+ commons-logging
+
+
@@ -392,6 +402,14 @@
log4j-web
+
+
+
+
+ org.postgresql
+ postgresql
+
+
@@ -410,21 +428,6 @@
jackson-annotations
-
-
-
-
- io.micrometer
- micrometer-commons
- ${micrometer.version}
-
-
-
- io.micrometer
- micrometer-observation
- ${micrometer.version}
-
-
@@ -452,22 +455,22 @@
test
-
- org.junit.platform
- junit-platform-runner
+
+ org.mockito
+ mockito-core
test
-
-
-
- junit
- junit
-
-
-
+
org.mockito
- mockito-core
+ mockito-junit-jupiter
+ test
+
+
+
+ org.assertj
+ assertj-core
+ ${assertj.version}
test
@@ -500,6 +503,12 @@
spring-boot-test-autoconfigure
test
+
+
+ com.h2database
+ h2
+ test
+
diff --git a/readme.md b/readme.md
index 2920fc1..9dc6b18 100644
--- a/readme.md
+++ b/readme.md
@@ -4,10 +4,10 @@ Example for setting up basic HTTP Security on a web service with Spring Boot.
## Usage
-Just run it as any Spring boot application:
+Start the Docker image:
```
-mvn spring-boot:run
+docker-compose -f docker/docker-compose.yml --project-name spring-ws-basic-security-example up
```
And the web service be available at [http://localhost:8080/](http://localhost:8080/).
@@ -28,12 +28,6 @@ To make things easier import `src/test/resources/basic_auth.postman_collection.j
| expcreds | 1111 | all |
| noread | 1111 | all minus read |
-[][site-release]
-[][site-develop]
-
-[][javadoc-release]
-[][javadoc-develop]
-
## Features
- [Spring MVC](https://spring.io/)
@@ -42,23 +36,13 @@ To make things easier import `src/test/resources/basic_auth.postman_collection.j
## Documentation
-Documentation is always generated for the latest release, kept in the 'master' branch:
-
-- The [latest release documentation page][site-release].
-- The [latest release Javadoc site][javadoc-release].
-
-Documentation is also generated from the latest snapshot, taken from the 'develop' branch:
-
-- The [the latest snapshot documentation page][site-develop].
-- The [latest snapshot Javadoc site][javadoc-develop].
-
-The documentation site is actually a Maven site, and its sources are included in the project. If required it can be generated by using the following Maven command:
+The documentation site is actually a Maven site, its sources are included in the project. Can be generated by using the following Maven command:
```
mvn verify site
```
-The verify phase is required, otherwise some of the reports won't be generated.
+The verify phase is required, otherwise some of the reports won't be built.
## Collaborate
@@ -80,9 +64,5 @@ If you wish to fork or modify the code, visit the [GitHub project page][scm], wh
The project has been released under the [MIT License][license].
[issues]: https://github.com/bernardo-mg/spring-ws-basic-security-example/issues
-[javadoc-develop]: https://docs.bernardomg.com/development/maven/spring-ws-basic-security-example/apidocs
-[javadoc-release]: https://docs.bernardomg.com/maven/spring-ws-basic-security-example/apidocs
[license]: https://www.opensource.org/licenses/mit-license.php
[scm]: https://github.com/bernardo-mg/spring-ws-basic-security-example
-[site-develop]: https://docs.bernardomg.com/development/maven/spring-ws-basic-security-example
-[site-release]: https://docs.bernardomg.com/maven/spring-ws-basic-security-example
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 087f681..7c804f9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -40,5 +40,10 @@
Recovered login.
+
+
+ Updated structure.
+
+