diff --git a/.drone/Dockerfile b/.drone/Dockerfile deleted file mode 100644 index e864726..0000000 --- a/.drone/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -ARG BASE_IMAGE - -FROM $BASE_IMAGE - -LABEL maintainer="dev@ujar.org" -ARG BUILD_VERSION -ENV APPLICATION_BUILD_VERSION ${BUILD_VERSION} - -WORKDIR /opt/app - -COPY ./target/*.jar /opt/app/app.jar - -ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Duser.timezone=UTC -jar /opt/app/app.jar"] -EXPOSE 8080 diff --git a/.drone/pipelines.yml b/.drone/pipelines.yml deleted file mode 100644 index 43b39ad..0000000 --- a/.drone/pipelines.yml +++ /dev/null @@ -1,454 +0,0 @@ -kind : pipeline -name : CodeVerification -type : docker - -trigger : - event : - - push - - tag - -volumes : - - name : m2cache - host : - path : /app/.m2 - -steps : - - - name : code-coverage-gate - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - volumes : - - name : m2cache - path : /root/.m2 - environment : - DATASOURCE_DRIVER : org.postgresql.Driver - R2DBC_DATASOURCE_URL : r2dbc:postgresql://db:5432/svc_testing_db - JDBC_DATASOURCE_URL : jdbc:postgresql://db:5432/svc_testing_db - DEPLOYER_USERNAME : - from_secret : DEPLOYER_USERNAME - DEPLOYER_PASSWORD : - from_secret : DEPLOYER_PASSWORD - commands : - - mvn -version - - mvn dependency:resolve -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD - - mvn clean verify -Dstyle.color=always -Dmaven.javadoc.skip=true -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD - - - name : static-analysis-gate - depends_on : - - code-coverage-gate - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - volumes : - - name : m2cache - path : /root/.m2 - environment : - DEPLOYER_USERNAME : - from_secret : DEPLOYER_USERNAME - DEPLOYER_PASSWORD : - from_secret : DEPLOYER_PASSWORD - SONAR_HOST : - from_secret : SONAR_HOST - SONAR_TOKEN : - from_secret : SONAR_TOKEN - commands : - - mvn org.apache.maven.plugins:maven-dependency-plugin:3.5.0:copy-dependencies -Dmdep.prependGroupId=true -Dstyle.color=always -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD - - mvn sonar:sonar '-Dsonar.java.libraries=target/dependency/*.jar' '-Dsonar.java.test.libraries=target/classes,target/dependency/*.jar' -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=300 -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=${DRONE_REPO_OWNER}:${DRONE_REPO_NAME} -Dsonar.projectName=${DRONE_REPO_OWNER}:${DRONE_REPO_NAME} -Dstyle.color=always -Dmaven.javadoc.skip=true --batch-mode -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD - - pmd check -d src -f text -R https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/basic.xml - - mvn com.github.spotbugs:spotbugs-maven-plugin:4.7.3.4:check -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD -Dspotbugs.xmlOutput=true -Dspotbugs.failOnError=true -Dspotbugs.excludeFilterFile=../spotbugs-exclude.xml -Dspotbugs.includeTests=true -Dstyle.color=always - - - name : notify-slack-on-failure - image : plugins/slack - settings : - webhook : - from_secret : SLACK_WEBHOOK - channel : dev - template : > - :red_circle: :thunder_cloud_and_rain: {{build.link}} ({{build.branch}}) by {{build.author}} - when : - status : - - failure - depends_on : - - code-coverage-gate - - static-analysis-gate - -services : - - name : db - image : postgres:13.12 - environment : - POSTGRES_USER : postgres - POSTGRES_PASSWORD : postgres - POSTGRES_DB : svc_testing_db - ---- - -kind : pipeline -name : ArtifactsPublishing -type : docker - -trigger : - event : - - push - - tag - ref : - - refs/heads/develop - - refs/heads/prerelease* - - refs/heads/*.*.x - - refs/tags/* - -depends_on : - - CodeVerification - -volumes : - - name : m2cache - host : - path : /app/.m2 - -steps : - - - name : publish-snapshot-jar - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - volumes : - - name : m2cache - path : /root/.m2 - environment : - DEPLOYER_USERNAME : - from_secret : DEPLOYER_USERNAME - DEPLOYER_PASSWORD : - from_secret : DEPLOYER_PASSWORD - commands : - - mvn deploy -Dstyle.color=always -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD -DaltDeploymentRepository=kh-contrib-snapshots-repo::https://know-how.nexus/repository/maven-snapshots - when : - branch : - include : - - "develop" - - "prerelease/*" - - "*.*.x" - - - name : publish-release-jar - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - volumes : - - name : m2cache - path : /root/.m2 - environment : - DEPLOYER_USERNAME : - from_secret : DEPLOYER_USERNAME - DEPLOYER_PASSWORD : - from_secret : DEPLOYER_PASSWORD - commands : - - mvn deploy -Dstyle.color=always -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD -DaltDeploymentRepository=kh-contrib-releases-repo::https://know-how.nexus/repository/maven-releases - when : - ref : - - "refs/tags/*" - - - name : create-github-release - image : plugins/github-release - settings : - api_key : - from_secret : GITHUB_API_KEY - title : ${DRONE_TAG} - note : "**Full Changelog**: https://github.com/${DRONE_REPO}/commits/${DRONE_TAG}" - files : ./target/*.jar - when : - ref : - - "refs/tags/*" - depends_on : - - publish-release-jar - - - name : notify-slack - image : plugins/slack - settings : - webhook : - from_secret : SLACK_WEBHOOK - channel : dev - template : > - {{#success build.status}} - :large_green_circle: :package: *${DRONE_COMMIT_MESSAGE}* - {{build.link}} ({{build.branch}}) by {{build.author}} - {{else}} - :red_circle: :package: {{build.link}} ({{build.branch}}) by {{build.author}} - {{/success}} - when : - status : - - failure - - success - depends_on : - - publish-snapshot-jar - - publish-release-jar - ---- - -kind : pipeline -name : DockerImagePublishing -type : docker - -trigger : - event : - - push - - tag - -depends_on : - - ArtifactsPublishing - -volumes : - - name : m2cache - host : - path : /app/.m2 - -steps : - - - name : package-jar - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - volumes : - - name : m2cache - path : /root/.m2 - environment : - DEPLOYER_USERNAME : - from_secret : DEPLOYER_USERNAME - DEPLOYER_PASSWORD : - from_secret : DEPLOYER_PASSWORD - commands : - - mvn package -Dstyle.color=always -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true --batch-mode -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD - - - name : build-container-with-feature - depends_on : - - package-jar - image : plugins/docker - settings : - dockerfile : ./.drone/Dockerfile - context : ./ - storage_driver : vfs - username : - from_secret : DOCKER_USERNAME - password : - from_secret : DOCKER_PASSWORD - repo : know-how.download/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME} - registry : know-how.download - force_tag : true - build_args : - - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - - BUILD_VERSION=${DRONE_COMMIT} - tags : - - ${DRONE_BRANCH:22}-${CI_BUILD_NUMBER} - when : - branch : - include : - - "feature/containerized-*" - - - name : build-container-release-image - depends_on : - - package-jar - image : plugins/docker - settings : - dockerfile : ./.drone/Dockerfile - context : ./ - storage_driver : vfs - username : - from_secret : DOCKER_USERNAME - password : - from_secret : DOCKER_PASSWORD - repo : know-how.download/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME} - registry : know-how.download - force_tag : true - build_args : - - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - - BUILD_VERSION=${DRONE_COMMIT} - tags : - - ${DRONE_TAG} - - "latest" - when : - ref : - - "refs/tags/*" - ---- - -kind : pipeline -name : PromoteFeatureDeployment -type : docker -trigger : - event : - - promote - target : - - sit - ref : - - "refs/heads/feature/containerized-*" - -steps : - - name : deploy - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - environment : - HELM_CHARTS_REPOSITORY : - from_secret : HELM_CHARTS_REPOSITORY - commands : - - git clone $${HELM_CHARTS_REPOSITORY} charts && cd charts/${DRONE_REPO_NAME} - - kubectl version --output=yaml - - helm upgrade --install --atomic --wait --timeout 2m ${DRONE_REPO_NAME} ./ --values ./values.yaml --values ./${DRONE_DEPLOY_TO}-values.yaml --set image.tag=${DRONE_BRANCH:22}-${CI_PARENT_BUILD_NUMBER} -n ${DRONE_DEPLOY_TO}-env - - - name : notify-slack - image : plugins/slack - settings : - webhook : - from_secret : SLACK_WEBHOOK - channel : dev - template : > - {{#success build.status}} - :large_green_circle: :ship: *${DRONE_COMMIT_MESSAGE}* - {{build.link}} ({{build.branch}}) by {{build.author}} - {{else}} - :red_circle: :anchor: {{build.link}} ({{build.branch}}) by {{build.author}} - {{/success}} - when : - status : - - failure - - success - depends_on : - - deploy - ---- - -kind : pipeline -name : RollbackFeatureDeployment -type : docker -trigger : - event : - - rollback - target : - - sit - ref : - - "refs/heads/feature/containerized-*" - -steps : - - name : rollback - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - environment : - HELM_CHARTS_REPOSITORY : - from_secret : HELM_CHARTS_REPOSITORY - commands : - - git clone $${HELM_CHARTS_REPOSITORY} charts && cd charts/${DRONE_REPO_NAME} - - helm uninstall --wait --timeout 2m ${DRONE_REPO_NAME} -n ${DRONE_DEPLOY_TO}-env - ---- - -kind : pipeline -name : PromoteDeployment -type : docker -trigger : - event : - - promote - target : - - uat - - production - ref : - - "refs/tags/*" - -steps : - - name : deploy - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - environment : - HELM_CHARTS_REPOSITORY : - from_secret : HELM_CHARTS_REPOSITORY - commands : - - git clone $${HELM_CHARTS_REPOSITORY} charts && cd charts/${DRONE_REPO_NAME} - - kubectl version --output=yaml - - helm upgrade --install --atomic --wait --timeout 2m ${DRONE_REPO_NAME} ./ --values ./values.yaml --values ./${DRONE_DEPLOY_TO}-values.yaml --set image.tag=${DRONE_TAG} -n ${DRONE_DEPLOY_TO}-env - - - name : notify-slack - image : plugins/slack - settings : - webhook : - from_secret : SLACK_WEBHOOK - channel : dev - template : > - {{#success build.status}} - :large_green_circle: :ship: *${DRONE_COMMIT_MESSAGE}* - {{build.link}} ({{build.branch}}) by {{build.author}} - {{else}} - :red_circle: :anchor: {{build.link}} ({{build.branch}}) by {{build.author}} - {{/success}} - when : - status : - - failure - - success - depends_on : - - deploy - ---- - -kind : pipeline -name : RollbackDeployment -type : docker -trigger : - event : - - rollback - target : - - uat - - production - ref : - - "refs/tags/*" - -steps : - - name : rollback - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - environment : - HELM_CHARTS_REPOSITORY : - from_secret : HELM_CHARTS_REPOSITORY - commands : - - git clone $${HELM_CHARTS_REPOSITORY} charts && cd charts/${DRONE_REPO_NAME} - - helm uninstall --wait --timeout 2m ${DRONE_REPO_NAME} -n ${DRONE_DEPLOY_TO}-env - ---- - -kind : pipeline -name : ManualRelease -type : docker -trigger : - event : - - custom - branch : - - "develop" - - "*.*.x" - -volumes : - - name : m2cache - host : - path : /app/.m2 - -steps : - - - name : create-release-tag - failure : ignore - image : know-how.download/svc-builder:openjdk-21-slim-bookworm - pull : if-not-exists - volumes : - - name : m2cache - path : /root/.m2 - commands : - - echo Prepare new version ${RELEASE_VERSION} - - export NEXT_SNAPSHOT=${SNAPSHOT_VERSION}-SNAPSHOT - - export GIT_AUTHOR_NAME="$${SVC_BUILD_GIT_USERNAME}" - - export GIT_AUTHOR_EMAIL=$${SVC_BUILD_GIT_EMAIL} - - export GIT_COMMITTER_NAME="$${SVC_BUILD_GIT_USERNAME}" - - export GIT_COMMITTER_EMAIL=$${SVC_BUILD_GIT_EMAIL} - - git remote set-url --push origin ${DRONE_GIT_SSH_URL} - - git checkout -b v${RELEASE_VERSION} - - mvn versions:set -DremoveSnapshot - - mvn versions:set -DnewVersion=${RELEASE_VERSION} - - mvn versions:update-parent - - >- - git commit -a -m "feat: bump version to $${RELEASE_VERSION}" - - git tag ${RELEASE_VERSION} && git push origin ${RELEASE_VERSION} - - echo "✅ Release tag ${RELEASE_VERSION} was created." - - sleep 10 - - git tag -d ${RELEASE_VERSION} && git checkout ${DRONE_COMMIT_BRANCH} && git branch -D v${RELEASE_VERSION} - - mvn versions:set -DnewVersion=$${NEXT_SNAPSHOT} - - mvn versions:update-parent -DallowSnapshots=true - - >- - git commit -a -m "feat: create new $${NEXT_SNAPSHOT}" - - git push origin ${DRONE_COMMIT_BRANCH} - - echo "✅ Started $${NEXT_SNAPSHOT}." - - echo "🚀 Good job, new version ${RELEASE_VERSION} was released successfully." diff --git a/.github/workflows/check-commit-message.yml b/.github/workflows/check-commit-message.yml index 0647443..96396e9 100644 --- a/.github/workflows/check-commit-message.yml +++ b/.github/workflows/check-commit-message.yml @@ -9,7 +9,7 @@ on : - synchronize push : branches : - - "develop" + - "dev" - "feature/*" - "bugfix/*" - "improvement/*" @@ -28,7 +28,7 @@ jobs : with : pattern : '^(feat|fix|docs|style|refactor|perf|test|chore|build)(.+?)?: .+' flags : 'gm' - error : 'Your commit title did not follow semantic versioning. Please see https://github.com/uJarOrg/.github/blob/develop/SEMANTIC_COMMITS.md' + error : 'Your commit title did not follow semantic versioning. Please see https://github.com/IQKV/.github/blob/dev/SEMANTIC_COMMITS.md' - name : Check Line Length uses : gsactions/commit-message-checker@v2 with : diff --git a/.husky/pre-commit b/.husky/pre-commit index 1bffa43..c1344cb 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,7 +2,7 @@ current_branch=$(git rev-parse --abbrev-ref HEAD) -main_branch="(main|master|develop)" +main_branch="(main|master|dev|develop)" if [[ $current_branch =~ $main_branch ]]; then echo -e "\033[1;31m[ERROR] Please don't commit directly to $current_branch.\033[0m"; exit 1 diff --git a/README.md b/README.md index eb2c66c..5a59ebb 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This application is a [Spring Boot](https://spring.io/guides/gs/spring-boot) app using [Maven](https://spring.io/guides/gs/maven/). You can build a jar file and run it from the command line: ``` -git clone https://github.com/uJarOrg/sample-webflux-crud-secured.git +git clone https://github.com/KnowHowSpringBoot/sample-webflux-crud-secured.git cd sample-webflux-crud-secured ./mvnw package java -jar target/*.jar @@ -46,7 +46,7 @@ Now you can access to the Swagger UI here: http://localhost:8080/swagger-ui.html 1) On the command line ``` -git clone https://github.com/uJarOrg/sample-webflux-crud-secured.git +git clone https://github.com/KnowHowSpringBoot/sample-webflux-crud-secured.git ``` 2) Inside IDE diff --git a/SEMANTIC_COMMITS.md b/SEMANTIC_COMMITS.md deleted file mode 100644 index bc1b47c..0000000 --- a/SEMANTIC_COMMITS.md +++ /dev/null @@ -1,35 +0,0 @@ -# Semantic Commit Messages - -See how a minor change to your commit message style can make you a better programmer. - -Format: `(): ` - -`` is optional - -## Example - -``` -feat: add hat wobble -^--^ ^------------^ -| | -| +-> Summary in present tense. -| -+-------> Type: chore, docs, feat, fix, refactor, style, or test. -``` - -More Examples: - -- `feat`: (new feature for the user, not a new feature for build script) -- `fix`: (bug fix for the user, not a fix to a build script) -- `docs`: (changes to the documentation) -- `style`: (formatting, missing semi colons, etc; no production code change) -- `refactor`: (refactoring production code, eg. renaming a variable) -- `test`: (adding missing tests, refactoring tests; no production code change) -- `chore`: (updating grunt tasks etc; no production code change) - -References: - -- https://www.conventionalcommits.org/ -- https://seesparkbox.com/foundry/semantic_commit_messages -- http://karma-runner.github.io/1.0/dev/git-commit-msg.html - diff --git a/package.json b/package.json index 543637a..7536560 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "sample-webflux-crud-secured", + "name": "know-how-spring-boot-sample-webflux-crud-secured", "version": "23.0.0", "description": "Provide an optional Git commit hooks.", "private": true, diff --git a/pom.xml b/pom.xml index 8836cc6..afcb924 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - org.ujar + dev.knowhowto.sb sample-webflux-crud-secured 23.0.0-SNAPSHOT jar @@ -18,12 +18,12 @@ - uJar Bootcamp - https://www.ujar.org + KnowHowSpringBoot Bootcamp + https://knowhowto.dev - 1 + dimdnk Dima Denysenko coding@dimdnk.com @@ -33,7 +33,7 @@ - org.ujar.boot + dev.knowhowto.boot boot-parent-pom 23.0.0-SNAPSHOT @@ -45,9 +45,10 @@ **/*Application.java **/*Config*.java,**/*Properties.java,**/*Test.java,**/Test*.java 2.10.5 + 9.22.3 false false - org.ujar.webfluxcrudsecured.WebfluxCrudSecuredApplication + dev.knowhowto.webfluxcrudsecured.WebfluxCrudSecuredApplication @@ -77,7 +78,7 @@ spring-boot-starter-webflux - org.ujar.boot + dev.knowhowto.boot boot-starter-observability @@ -114,6 +115,7 @@ org.flywaydb flyway-core + ${flyway.version} org.springframework.boot @@ -180,7 +182,7 @@ spring-boot-starter-undertow - org.ujar.boot + dev.knowhowto.boot boot-starter-cache diff --git a/src/main/docker/prometheus/prometheus.yml b/src/main/docker/prometheus/prometheus.yml index 462f09f..2696564 100644 --- a/src/main/docker/prometheus/prometheus.yml +++ b/src/main/docker/prometheus/prometheus.yml @@ -1,4 +1,4 @@ -# Sample global config for monitoring uJar applications +# Sample global config for monitoring KnowHowSpringBoot applications global : scrape_interval : 15s # By default, scrape targets every 15 seconds. evaluation_interval : 15s # By default, scrape targets every 15 seconds. @@ -7,7 +7,7 @@ global : # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). external_labels : - monitor : 'ujar' + monitor : 'knowhowto' # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. diff --git a/src/main/java/org/ujar/webfluxcrudsecured/WebfluxCrudSecuredApplication.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/WebfluxCrudSecuredApplication.java similarity index 92% rename from src/main/java/org/ujar/webfluxcrudsecured/WebfluxCrudSecuredApplication.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/WebfluxCrudSecuredApplication.java index 511a378..e0ef49d 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/WebfluxCrudSecuredApplication.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/WebfluxCrudSecuredApplication.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured; +package dev.knowhowto.webfluxcrudsecured; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/client/UserClient.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/client/UserClient.java similarity index 91% rename from src/main/java/org/ujar/webfluxcrudsecured/client/UserClient.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/client/UserClient.java index 9a2b6a1..d945c0f 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/client/UserClient.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/client/UserClient.java @@ -1,10 +1,10 @@ -package org.ujar.webfluxcrudsecured.client; +package dev.knowhowto.webfluxcrudsecured.client; +import dev.knowhowto.webfluxcrudsecured.entity.User; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; -import org.ujar.webfluxcrudsecured.entity.User; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/ApplicationBuildInfoProperties.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/ApplicationBuildInfoProperties.java similarity index 85% rename from src/main/java/org/ujar/webfluxcrudsecured/config/ApplicationBuildInfoProperties.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/ApplicationBuildInfoProperties.java index 409cb00..df70ae7 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/ApplicationBuildInfoProperties.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/ApplicationBuildInfoProperties.java @@ -1,10 +1,10 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import jakarta.validation.constraints.NotNull; import org.springframework.boot.context.properties.ConfigurationProperties; -@ConfigurationProperties("ujar.build") +@ConfigurationProperties("knowhowto.build") public record ApplicationBuildInfoProperties(@NotNull String version, @NotNull String description, @NotNull String relativePath) { diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/ApplicationConfig.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/ApplicationConfig.java similarity index 88% rename from src/main/java/org/ujar/webfluxcrudsecured/config/ApplicationConfig.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/ApplicationConfig.java index 0a851fd..3d37fb3 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/ApplicationConfig.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/ApplicationConfig.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/AuthenticationManager.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/AuthenticationManager.java similarity index 97% rename from src/main/java/org/ujar/webfluxcrudsecured/config/AuthenticationManager.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/AuthenticationManager.java index a232017..a9254ee 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/AuthenticationManager.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/AuthenticationManager.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import java.util.List; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/CacheConfig.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/CacheConfig.java similarity index 93% rename from src/main/java/org/ujar/webfluxcrudsecured/config/CacheConfig.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/CacheConfig.java index 5f5fff6..ae3640e 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/CacheConfig.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/CacheConfig.java @@ -1,7 +1,9 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import java.time.Duration; +import dev.knowhowto.boot.cache.CacheProperties; +import dev.knowhowto.webfluxcrudsecured.entity.User; import org.ehcache.config.builders.CacheConfigurationBuilder; import org.ehcache.config.builders.ExpiryPolicyBuilder; import org.ehcache.config.builders.ResourcePoolsBuilder; @@ -12,8 +14,6 @@ import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.ujar.boot.cache.CacheProperties; -import org.ujar.webfluxcrudsecured.entity.User; @Configuration @EnableCaching diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/JwtTokenProperties.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/JwtTokenProperties.java similarity index 77% rename from src/main/java/org/ujar/webfluxcrudsecured/config/JwtTokenProperties.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/JwtTokenProperties.java index 9ffaf4f..807b802 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/JwtTokenProperties.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/JwtTokenProperties.java @@ -1,10 +1,10 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import jakarta.validation.constraints.NotNull; import org.springframework.boot.context.properties.ConfigurationProperties; -@ConfigurationProperties("ujar.jwt.token") +@ConfigurationProperties("knowhowto.jwt.token") public record JwtTokenProperties(@NotNull String secret, @NotNull Long expiration) { public String getSecret() { diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/JwtUtil.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/JwtUtil.java similarity index 94% rename from src/main/java/org/ujar/webfluxcrudsecured/config/JwtUtil.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/JwtUtil.java index cb283de..57b1f23 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/JwtUtil.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/JwtUtil.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -6,12 +6,12 @@ import java.util.HashMap; import java.util.List; +import dev.knowhowto.webfluxcrudsecured.entity.User; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.security.Keys; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import org.ujar.webfluxcrudsecured.entity.User; @Component @RequiredArgsConstructor diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/SecurityContextRepository.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/SecurityContextRepository.java similarity index 96% rename from src/main/java/org/ujar/webfluxcrudsecured/config/SecurityContextRepository.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/SecurityContextRepository.java index c32ebad..9610dc1 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/SecurityContextRepository.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/SecurityContextRepository.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import org.springframework.http.HttpHeaders; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/SwaggerConfig.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/SwaggerConfig.java similarity index 95% rename from src/main/java/org/ujar/webfluxcrudsecured/config/SwaggerConfig.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/SwaggerConfig.java index bf0bce2..f6f4c59 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/SwaggerConfig.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/SwaggerConfig.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/config/WebSecurityConfig.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/WebSecurityConfig.java similarity index 97% rename from src/main/java/org/ujar/webfluxcrudsecured/config/WebSecurityConfig.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/config/WebSecurityConfig.java index e7fa5b5..ef422ec 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/config/WebSecurityConfig.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/config/WebSecurityConfig.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.config; +package dev.knowhowto.webfluxcrudsecured.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/dto/UserDepartmentDTO.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/dto/UserDepartmentDTO.java similarity index 89% rename from src/main/java/org/ujar/webfluxcrudsecured/dto/UserDepartmentDTO.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/dto/UserDepartmentDTO.java index 1078932..20f9302 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/dto/UserDepartmentDTO.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/dto/UserDepartmentDTO.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.dto; +package dev.knowhowto.webfluxcrudsecured.dto; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/entity/Department.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/entity/Department.java similarity index 92% rename from src/main/java/org/ujar/webfluxcrudsecured/entity/Department.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/entity/Department.java index b2e3a72..870c5dd 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/entity/Department.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/entity/Department.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.entity; +package dev.knowhowto.webfluxcrudsecured.entity; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/entity/User.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/entity/User.java similarity index 94% rename from src/main/java/org/ujar/webfluxcrudsecured/entity/User.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/entity/User.java index 07700ef..f1a9d9c 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/entity/User.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/entity/User.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.entity; +package dev.knowhowto.webfluxcrudsecured.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/entity/UserRole.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/entity/UserRole.java similarity index 50% rename from src/main/java/org/ujar/webfluxcrudsecured/entity/UserRole.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/entity/UserRole.java index 5f7c5e1..c9c0a45 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/entity/UserRole.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/entity/UserRole.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured.entity; +package dev.knowhowto.webfluxcrudsecured.entity; public enum UserRole { ROLE_USER, ROLE_ADMIN diff --git a/src/main/java/org/ujar/webfluxcrudsecured/repository/DepartmentRepository.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/repository/DepartmentRepository.java similarity index 69% rename from src/main/java/org/ujar/webfluxcrudsecured/repository/DepartmentRepository.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/repository/DepartmentRepository.java index 3fd7ecc..6e04743 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/repository/DepartmentRepository.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/repository/DepartmentRepository.java @@ -1,7 +1,7 @@ -package org.ujar.webfluxcrudsecured.repository; +package dev.knowhowto.webfluxcrudsecured.repository; +import dev.knowhowto.webfluxcrudsecured.entity.Department; import org.springframework.data.repository.reactive.ReactiveCrudRepository; -import org.ujar.webfluxcrudsecured.entity.Department; import reactor.core.publisher.Mono; public interface DepartmentRepository extends ReactiveCrudRepository { diff --git a/src/main/java/org/ujar/webfluxcrudsecured/repository/UserRepository.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/repository/UserRepository.java similarity index 75% rename from src/main/java/org/ujar/webfluxcrudsecured/repository/UserRepository.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/repository/UserRepository.java index 789a520..5efbc92 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/repository/UserRepository.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/repository/UserRepository.java @@ -1,8 +1,8 @@ -package org.ujar.webfluxcrudsecured.repository; +package dev.knowhowto.webfluxcrudsecured.repository; +import dev.knowhowto.webfluxcrudsecured.entity.User; import org.springframework.data.r2dbc.repository.Query; import org.springframework.data.repository.reactive.ReactiveCrudRepository; -import org.ujar.webfluxcrudsecured.entity.User; import reactor.core.publisher.Flux; public interface UserRepository extends ReactiveCrudRepository { diff --git a/src/main/java/org/ujar/webfluxcrudsecured/service/UserService.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/service/UserService.java similarity index 87% rename from src/main/java/org/ujar/webfluxcrudsecured/service/UserService.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/service/UserService.java index 43f496d..b477a79 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/service/UserService.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/service/UserService.java @@ -1,17 +1,17 @@ -package org.ujar.webfluxcrudsecured.service; +package dev.knowhowto.webfluxcrudsecured.service; import java.util.List; import java.util.function.BiFunction; +import dev.knowhowto.webfluxcrudsecured.dto.UserDepartmentDTO; +import dev.knowhowto.webfluxcrudsecured.entity.Department; +import dev.knowhowto.webfluxcrudsecured.entity.User; +import dev.knowhowto.webfluxcrudsecured.repository.DepartmentRepository; +import dev.knowhowto.webfluxcrudsecured.repository.UserRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.ujar.webfluxcrudsecured.dto.UserDepartmentDTO; -import org.ujar.webfluxcrudsecured.entity.Department; -import org.ujar.webfluxcrudsecured.entity.User; -import org.ujar.webfluxcrudsecured.repository.DepartmentRepository; -import org.ujar.webfluxcrudsecured.repository.UserRepository; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/web/UserClientResource.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/web/UserClientResource.java similarity index 90% rename from src/main/java/org/ujar/webfluxcrudsecured/web/UserClientResource.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/web/UserClientResource.java index 46fe91a..ff849af 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/web/UserClientResource.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/web/UserClientResource.java @@ -1,5 +1,7 @@ -package org.ujar.webfluxcrudsecured.web; +package dev.knowhowto.webfluxcrudsecured.web; +import dev.knowhowto.webfluxcrudsecured.client.UserClient; +import dev.knowhowto.webfluxcrudsecured.entity.User; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.springframework.http.HttpStatus; @@ -11,8 +13,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import org.ujar.webfluxcrudsecured.client.UserClient; -import org.ujar.webfluxcrudsecured.entity.User; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; diff --git a/src/main/java/org/ujar/webfluxcrudsecured/web/UserResource.java b/src/main/java/dev/knowhowto/webfluxcrudsecured/web/UserResource.java similarity index 93% rename from src/main/java/org/ujar/webfluxcrudsecured/web/UserResource.java rename to src/main/java/dev/knowhowto/webfluxcrudsecured/web/UserResource.java index 74ea4ea..dc15fb4 100644 --- a/src/main/java/org/ujar/webfluxcrudsecured/web/UserResource.java +++ b/src/main/java/dev/knowhowto/webfluxcrudsecured/web/UserResource.java @@ -1,7 +1,10 @@ -package org.ujar.webfluxcrudsecured.web; +package dev.knowhowto.webfluxcrudsecured.web; import java.util.List; +import dev.knowhowto.webfluxcrudsecured.dto.UserDepartmentDTO; +import dev.knowhowto.webfluxcrudsecured.entity.User; +import dev.knowhowto.webfluxcrudsecured.service.UserService; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.springframework.http.HttpStatus; @@ -15,9 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import org.ujar.webfluxcrudsecured.dto.UserDepartmentDTO; -import org.ujar.webfluxcrudsecured.entity.User; -import org.ujar.webfluxcrudsecured.service.UserService; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4877ed6..ffd229b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -138,7 +138,7 @@ management : prometheus : enabled : true -ujar : +knowhowto : build : description : '@project.description@' relative-path : ${SERVER_SERVLET_CONTEXT_PATH:/} diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt index 3865522..f4a67b9 100644 --- a/src/main/resources/banner.txt +++ b/src/main/resources/banner.txt @@ -1,8 +1,3 @@ -${AnsiColor.GREEN} | | -${AnsiColor.GREEN} _ _ | | __ _ _ __ -${AnsiColor.GREEN} | | | | _ | | / _` | | '__| -${AnsiColor.GREEN} | |_| | | |__| | | (_| | | | -${AnsiColor.GREEN} \__,_| \____/ \__,_| |_| ${AnsiColor.BLUE} =============================== ${AnsiColor.BLUE} User management REST API ${AnsiColor.BLUE} Running Spring Boot ${spring-boot.version} diff --git a/src/test/java/org/ujar/webfluxcrudsecured/WebfluxCrudSecuredApplicationIT.java b/src/test/java/dev/knowhowto/webfluxcrudsecured/WebfluxCrudSecuredApplicationIT.java similarity index 90% rename from src/test/java/org/ujar/webfluxcrudsecured/WebfluxCrudSecuredApplicationIT.java rename to src/test/java/dev/knowhowto/webfluxcrudsecured/WebfluxCrudSecuredApplicationIT.java index a74ceba..15559ba 100644 --- a/src/test/java/org/ujar/webfluxcrudsecured/WebfluxCrudSecuredApplicationIT.java +++ b/src/test/java/dev/knowhowto/webfluxcrudsecured/WebfluxCrudSecuredApplicationIT.java @@ -1,4 +1,4 @@ -package org.ujar.webfluxcrudsecured; +package dev.knowhowto.webfluxcrudsecured; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 86a8f9b..6380352 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -37,7 +37,7 @@ spring : hibernate.generate_statistics : false show-sql : false -ujar : +knowhowto : build : description : '@project.description@' relative-path : '/'