diff --git a/.idea/modules/spring-boot-testing.iml b/.idea/modules/spring-boot-testing.iml index d059007..0cb765f 100644 --- a/.idea/modules/spring-boot-testing.iml +++ b/.idea/modules/spring-boot-testing.iml @@ -1,5 +1,5 @@ - + diff --git a/patterns/build.gradle b/patterns/build.gradle index b089eb6..7b471a9 100644 --- a/patterns/build.gradle +++ b/patterns/build.gradle @@ -18,5 +18,10 @@ dependencies { compileOnly 'org.projectlombok:lombok:1.18.2' testCompile 'org.junit.jupiter:junit-jupiter-engine:5.0.1' testCompile 'org.assertj:assertj-core:2.6.0' + compile files('lib/java-2.0.jar') } +compileJava.options.fork = true +compileJava.options.forkOptions.executable = 'C:\\Program Files\\Java\\jdk-11\\bin\\javac.exe' + + diff --git a/patterns/gradlew b/patterns/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/patterns/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/patterns/gradlew.bat b/patterns/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/patterns/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle index 777311d..b96782c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,6 +19,7 @@ include 'spring-boot:modular:booking-module' include 'spring-boot:modular:application' include 'spring-boot:spring-boot-testing' include 'spring-boot:spring-boot-logging' +include 'spring-boot:validation' include 'logging' @@ -28,5 +29,7 @@ include 'patterns' include 'tools:jacoco' +include 'java' + diff --git a/spring-boot/validation/.gitignore b/spring-boot/validation/.gitignore new file mode 100644 index 0000000..9243c63 --- /dev/null +++ b/spring-boot/validation/.gitignore @@ -0,0 +1,26 @@ +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/spring-boot/validation/build.gradle b/spring-boot/validation/build.gradle new file mode 100644 index 0000000..f17cfbc --- /dev/null +++ b/spring-boot/validation/build.gradle @@ -0,0 +1,39 @@ +buildscript { + ext { + springBootVersion = '2.0.5.RELEASE' + } + repositories { + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + } +} + +apply plugin: 'java' +apply plugin: 'eclipse' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' + +group = 'io.reflectoring' +version = '0.0.1-SNAPSHOT' +sourceCompatibility = 1.8 + +repositories { + mavenCentral() +} + + +dependencies { + implementation('org.springframework.boot:spring-boot-starter-data-jpa') + implementation('org.springframework.boot:spring-boot-starter-validation') + implementation('org.springframework.boot:spring-boot-starter-web') + runtimeOnly('com.h2database:h2') + testImplementation('org.springframework.boot:spring-boot-starter-test') + testImplementation('org.junit.jupiter:junit-jupiter-engine:5.0.1') + + // these dependencies are needed when running with Java 11, since they + // are no longer part of the JDK + implementation('javax.xml.bind:jaxb-api:2.3.1') + implementation('org.javassist:javassist:3.23.1-GA') +} diff --git a/spring-boot/validation/deps.txt b/spring-boot/validation/deps.txt new file mode 100644 index 0000000..7a9158d --- /dev/null +++ b/spring-boot/validation/deps.txt @@ -0,0 +1,735 @@ + +> Task :dependencies + +------------------------------------------------------------ +Root project +------------------------------------------------------------ + +annotationProcessor - Annotation processors and their dependencies for source set 'main'. +No dependencies + +apiElements - API elements for main. (n) +No dependencies + +archives - Configuration for archive artifacts. +No dependencies + +bootArchives - Configuration for Spring Boot archive artifacts. +No dependencies + +compile - Dependencies for source set 'main' (deprecated, use 'implementation' instead). +No dependencies + +compileClasspath - Compile classpath for source set 'main'. ++--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot:2.0.5.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE +| | | | \--- org.springframework:spring-jcl:5.0.9.RELEASE +| | | \--- org.springframework:spring-context:5.0.9.RELEASE +| | | +--- org.springframework:spring-aop:5.0.9.RELEASE +| | | | +--- org.springframework:spring-beans:5.0.9.RELEASE +| | | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-expression:5.0.9.RELEASE +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE +| | | \--- org.springframework.boot:spring-boot:2.0.5.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE +| | | +--- ch.qos.logback:logback-classic:1.2.3 +| | | | +--- ch.qos.logback:logback-core:1.2.3 +| | | | \--- org.slf4j:slf4j-api:1.7.25 +| | | +--- org.apache.logging.log4j:log4j-to-slf4j:2.10.0 +| | | | +--- org.slf4j:slf4j-api:1.7.25 +| | | | \--- org.apache.logging.log4j:log4j-api:2.10.0 +| | | \--- org.slf4j:jul-to-slf4j:1.7.25 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.yaml:snakeyaml:1.19 +| +--- org.springframework.boot:spring-boot-starter-aop:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | \--- org.aspectj:aspectjweaver:1.8.13 +| +--- org.springframework.boot:spring-boot-starter-jdbc:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- com.zaxxer:HikariCP:2.7.9 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | \--- org.springframework:spring-jdbc:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-tx:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- javax.transaction:javax.transaction-api:1.2 +| +--- org.hibernate:hibernate-core:5.2.17.Final +| | +--- org.jboss.logging:jboss-logging:3.3.1.Final -> 3.3.2.Final +| | +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final -> 1.0.2.Final +| | +--- org.javassist:javassist:3.22.0-GA -> 3.23.1-GA +| | +--- antlr:antlr:2.7.7 +| | +--- org.jboss:jandex:2.0.3.Final +| | +--- com.fasterxml:classmate:1.3.0 -> 1.3.4 +| | +--- dom4j:dom4j:1.6.1 +| | \--- org.hibernate.common:hibernate-commons-annotations:5.0.1.Final +| | \--- org.jboss.logging:jboss-logging:3.3.0.Final -> 3.3.2.Final +| +--- org.springframework.data:spring-data-jpa:2.0.10.RELEASE +| | +--- org.springframework.data:spring-data-commons:2.0.10.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- org.springframework:spring-orm:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-jdbc:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.slf4j:slf4j-api:1.7.25 +| \--- org.springframework:spring-aspects:5.0.9.RELEASE +| \--- org.aspectj:aspectjweaver:1.8.13 ++--- org.springframework.boot:spring-boot-starter-validation -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| \--- org.hibernate.validator:hibernate-validator:6.0.12.Final +| +--- javax.validation:validation-api:2.0.1.Final +| +--- org.jboss.logging:jboss-logging:3.3.2.Final +| \--- com.fasterxml:classmate:1.3.4 ++--- org.springframework.boot:spring-boot-starter-web -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-web:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- com.fasterxml.jackson.core:jackson-databind:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | \--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6 +| | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| +--- org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| | +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| +--- org.hibernate.validator:hibernate-validator:6.0.12.Final (*) +| +--- org.springframework:spring-web:5.0.9.RELEASE (*) +| \--- org.springframework:spring-webmvc:5.0.9.RELEASE +| +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- org.springframework:spring-expression:5.0.9.RELEASE (*) +| \--- org.springframework:spring-web:5.0.9.RELEASE (*) ++--- javax.xml.bind:jaxb-api:2.3.1 +| \--- javax.activation:javax.activation-api:1.2.0 +\--- org.javassist:javassist:3.23.1-GA + +compileOnly - Compile only dependencies for source set 'main'. +No dependencies + +default - Configuration for default artifacts. ++--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot:2.0.5.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE +| | | | \--- org.springframework:spring-jcl:5.0.9.RELEASE +| | | \--- org.springframework:spring-context:5.0.9.RELEASE +| | | +--- org.springframework:spring-aop:5.0.9.RELEASE +| | | | +--- org.springframework:spring-beans:5.0.9.RELEASE +| | | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-expression:5.0.9.RELEASE +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE +| | | \--- org.springframework.boot:spring-boot:2.0.5.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE +| | | +--- ch.qos.logback:logback-classic:1.2.3 +| | | | +--- ch.qos.logback:logback-core:1.2.3 +| | | | \--- org.slf4j:slf4j-api:1.7.25 +| | | +--- org.apache.logging.log4j:log4j-to-slf4j:2.10.0 +| | | | +--- org.slf4j:slf4j-api:1.7.25 +| | | | \--- org.apache.logging.log4j:log4j-api:2.10.0 +| | | \--- org.slf4j:jul-to-slf4j:1.7.25 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.yaml:snakeyaml:1.19 +| +--- org.springframework.boot:spring-boot-starter-aop:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | \--- org.aspectj:aspectjweaver:1.8.13 +| +--- org.springframework.boot:spring-boot-starter-jdbc:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- com.zaxxer:HikariCP:2.7.9 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | \--- org.springframework:spring-jdbc:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-tx:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- javax.transaction:javax.transaction-api:1.2 +| +--- org.hibernate:hibernate-core:5.2.17.Final +| | +--- org.jboss.logging:jboss-logging:3.3.1.Final -> 3.3.2.Final +| | +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final -> 1.0.2.Final +| | +--- org.javassist:javassist:3.22.0-GA -> 3.23.1-GA +| | +--- antlr:antlr:2.7.7 +| | +--- org.jboss:jandex:2.0.3.Final +| | +--- com.fasterxml:classmate:1.3.0 -> 1.3.4 +| | +--- dom4j:dom4j:1.6.1 +| | \--- org.hibernate.common:hibernate-commons-annotations:5.0.1.Final +| | \--- org.jboss.logging:jboss-logging:3.3.0.Final -> 3.3.2.Final +| +--- org.springframework.data:spring-data-jpa:2.0.10.RELEASE +| | +--- org.springframework.data:spring-data-commons:2.0.10.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- org.springframework:spring-orm:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-jdbc:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.slf4j:slf4j-api:1.7.25 +| \--- org.springframework:spring-aspects:5.0.9.RELEASE +| \--- org.aspectj:aspectjweaver:1.8.13 ++--- org.springframework.boot:spring-boot-starter-validation -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| \--- org.hibernate.validator:hibernate-validator:6.0.12.Final +| +--- javax.validation:validation-api:2.0.1.Final +| +--- org.jboss.logging:jboss-logging:3.3.2.Final +| \--- com.fasterxml:classmate:1.3.4 ++--- org.springframework.boot:spring-boot-starter-web -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-web:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- com.fasterxml.jackson.core:jackson-databind:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | \--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6 +| | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| +--- org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| | +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| +--- org.hibernate.validator:hibernate-validator:6.0.12.Final (*) +| +--- org.springframework:spring-web:5.0.9.RELEASE (*) +| \--- org.springframework:spring-webmvc:5.0.9.RELEASE +| +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- org.springframework:spring-expression:5.0.9.RELEASE (*) +| \--- org.springframework:spring-web:5.0.9.RELEASE (*) ++--- javax.xml.bind:jaxb-api:2.3.1 +| \--- javax.activation:javax.activation-api:1.2.0 ++--- org.javassist:javassist:3.23.1-GA +\--- com.h2database:h2 -> 1.4.197 + +implementation - Implementation only dependencies for source set 'main'. (n) ++--- org.springframework.boot:spring-boot-starter-data-jpa (n) ++--- org.springframework.boot:spring-boot-starter-validation (n) ++--- org.springframework.boot:spring-boot-starter-web (n) ++--- javax.xml.bind:jaxb-api:2.3.1 (n) +\--- org.javassist:javassist:3.23.1-GA (n) + +runtime - Runtime dependencies for source set 'main' (deprecated, use 'runtimeOnly' instead). +No dependencies + +runtimeClasspath - Runtime classpath of source set 'main'. ++--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot:2.0.5.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE +| | | | \--- org.springframework:spring-jcl:5.0.9.RELEASE +| | | \--- org.springframework:spring-context:5.0.9.RELEASE +| | | +--- org.springframework:spring-aop:5.0.9.RELEASE +| | | | +--- org.springframework:spring-beans:5.0.9.RELEASE +| | | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-expression:5.0.9.RELEASE +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE +| | | \--- org.springframework.boot:spring-boot:2.0.5.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE +| | | +--- ch.qos.logback:logback-classic:1.2.3 +| | | | +--- ch.qos.logback:logback-core:1.2.3 +| | | | \--- org.slf4j:slf4j-api:1.7.25 +| | | +--- org.apache.logging.log4j:log4j-to-slf4j:2.10.0 +| | | | +--- org.slf4j:slf4j-api:1.7.25 +| | | | \--- org.apache.logging.log4j:log4j-api:2.10.0 +| | | \--- org.slf4j:jul-to-slf4j:1.7.25 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.yaml:snakeyaml:1.19 +| +--- org.springframework.boot:spring-boot-starter-aop:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | \--- org.aspectj:aspectjweaver:1.8.13 +| +--- org.springframework.boot:spring-boot-starter-jdbc:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- com.zaxxer:HikariCP:2.7.9 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | \--- org.springframework:spring-jdbc:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-tx:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- javax.transaction:javax.transaction-api:1.2 +| +--- org.hibernate:hibernate-core:5.2.17.Final +| | +--- org.jboss.logging:jboss-logging:3.3.1.Final -> 3.3.2.Final +| | +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final -> 1.0.2.Final +| | +--- org.javassist:javassist:3.22.0-GA -> 3.23.1-GA +| | +--- antlr:antlr:2.7.7 +| | +--- org.jboss:jandex:2.0.3.Final +| | +--- com.fasterxml:classmate:1.3.0 -> 1.3.4 +| | +--- dom4j:dom4j:1.6.1 +| | \--- org.hibernate.common:hibernate-commons-annotations:5.0.1.Final +| | \--- org.jboss.logging:jboss-logging:3.3.0.Final -> 3.3.2.Final +| +--- org.springframework.data:spring-data-jpa:2.0.10.RELEASE +| | +--- org.springframework.data:spring-data-commons:2.0.10.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- org.springframework:spring-orm:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-jdbc:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.slf4j:slf4j-api:1.7.25 +| \--- org.springframework:spring-aspects:5.0.9.RELEASE +| \--- org.aspectj:aspectjweaver:1.8.13 ++--- org.springframework.boot:spring-boot-starter-validation -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| \--- org.hibernate.validator:hibernate-validator:6.0.12.Final +| +--- javax.validation:validation-api:2.0.1.Final +| +--- org.jboss.logging:jboss-logging:3.3.2.Final +| \--- com.fasterxml:classmate:1.3.4 ++--- org.springframework.boot:spring-boot-starter-web -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-web:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- com.fasterxml.jackson.core:jackson-databind:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | \--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6 +| | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| +--- org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| | +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| +--- org.hibernate.validator:hibernate-validator:6.0.12.Final (*) +| +--- org.springframework:spring-web:5.0.9.RELEASE (*) +| \--- org.springframework:spring-webmvc:5.0.9.RELEASE +| +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- org.springframework:spring-expression:5.0.9.RELEASE (*) +| \--- org.springframework:spring-web:5.0.9.RELEASE (*) ++--- javax.xml.bind:jaxb-api:2.3.1 +| \--- javax.activation:javax.activation-api:1.2.0 ++--- org.javassist:javassist:3.23.1-GA +\--- com.h2database:h2 -> 1.4.197 + +runtimeElements - Elements of runtime for main. (n) +No dependencies + +runtimeOnly - Runtime only dependencies for source set 'main'. (n) +\--- com.h2database:h2 (n) + +testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'. +No dependencies + +testCompile - Dependencies for source set 'test' (deprecated, use 'testImplementation' instead). +No dependencies + +testCompileClasspath - Compile classpath for source set 'test'. ++--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot:2.0.5.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE +| | | | \--- org.springframework:spring-jcl:5.0.9.RELEASE +| | | \--- org.springframework:spring-context:5.0.9.RELEASE +| | | +--- org.springframework:spring-aop:5.0.9.RELEASE +| | | | +--- org.springframework:spring-beans:5.0.9.RELEASE +| | | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-expression:5.0.9.RELEASE +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE +| | | \--- org.springframework.boot:spring-boot:2.0.5.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE +| | | +--- ch.qos.logback:logback-classic:1.2.3 +| | | | +--- ch.qos.logback:logback-core:1.2.3 +| | | | \--- org.slf4j:slf4j-api:1.7.25 +| | | +--- org.apache.logging.log4j:log4j-to-slf4j:2.10.0 +| | | | +--- org.slf4j:slf4j-api:1.7.25 +| | | | \--- org.apache.logging.log4j:log4j-api:2.10.0 +| | | \--- org.slf4j:jul-to-slf4j:1.7.25 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.yaml:snakeyaml:1.19 +| +--- org.springframework.boot:spring-boot-starter-aop:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | \--- org.aspectj:aspectjweaver:1.8.13 +| +--- org.springframework.boot:spring-boot-starter-jdbc:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- com.zaxxer:HikariCP:2.7.9 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | \--- org.springframework:spring-jdbc:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-tx:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- javax.transaction:javax.transaction-api:1.2 +| +--- org.hibernate:hibernate-core:5.2.17.Final +| | +--- org.jboss.logging:jboss-logging:3.3.1.Final -> 3.3.2.Final +| | +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final -> 1.0.2.Final +| | +--- org.javassist:javassist:3.22.0-GA -> 3.23.1-GA +| | +--- antlr:antlr:2.7.7 +| | +--- org.jboss:jandex:2.0.3.Final +| | +--- com.fasterxml:classmate:1.3.0 -> 1.3.4 +| | +--- dom4j:dom4j:1.6.1 +| | \--- org.hibernate.common:hibernate-commons-annotations:5.0.1.Final +| | \--- org.jboss.logging:jboss-logging:3.3.0.Final -> 3.3.2.Final +| +--- org.springframework.data:spring-data-jpa:2.0.10.RELEASE +| | +--- org.springframework.data:spring-data-commons:2.0.10.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- org.springframework:spring-orm:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-jdbc:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.slf4j:slf4j-api:1.7.25 +| \--- org.springframework:spring-aspects:5.0.9.RELEASE +| \--- org.aspectj:aspectjweaver:1.8.13 ++--- org.springframework.boot:spring-boot-starter-validation -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| \--- org.hibernate.validator:hibernate-validator:6.0.12.Final +| +--- javax.validation:validation-api:2.0.1.Final +| +--- org.jboss.logging:jboss-logging:3.3.2.Final +| \--- com.fasterxml:classmate:1.3.4 ++--- org.springframework.boot:spring-boot-starter-web -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-web:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- com.fasterxml.jackson.core:jackson-databind:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | \--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6 +| | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| +--- org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| | +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| +--- org.hibernate.validator:hibernate-validator:6.0.12.Final (*) +| +--- org.springframework:spring-web:5.0.9.RELEASE (*) +| \--- org.springframework:spring-webmvc:5.0.9.RELEASE +| +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- org.springframework:spring-expression:5.0.9.RELEASE (*) +| \--- org.springframework:spring-web:5.0.9.RELEASE (*) ++--- javax.xml.bind:jaxb-api:2.3.1 +| \--- javax.activation:javax.activation-api:1.2.0 ++--- org.javassist:javassist:3.23.1-GA ++--- org.springframework.boot:spring-boot-starter-test -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-test:2.0.5.RELEASE +| | \--- org.springframework.boot:spring-boot:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-test-autoconfigure:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-test:2.0.5.RELEASE (*) +| | \--- org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE (*) +| +--- com.jayway.jsonpath:json-path:2.4.0 +| | +--- net.minidev:json-smart:2.3 +| | | \--- net.minidev:accessors-smart:1.2 +| | | \--- org.ow2.asm:asm:5.0.4 +| | \--- org.slf4j:slf4j-api:1.7.25 +| +--- junit:junit:4.12 +| | \--- org.hamcrest:hamcrest-core:1.3 +| +--- org.assertj:assertj-core:3.9.1 +| +--- org.mockito:mockito-core:2.15.0 +| | +--- net.bytebuddy:byte-buddy:1.7.9 -> 1.7.11 +| | +--- net.bytebuddy:byte-buddy-agent:1.7.9 -> 1.7.11 +| | \--- org.objenesis:objenesis:2.6 +| +--- org.hamcrest:hamcrest-core:1.3 +| +--- org.hamcrest:hamcrest-library:1.3 +| | \--- org.hamcrest:hamcrest-core:1.3 +| +--- org.skyscreamer:jsonassert:1.5.0 +| | \--- com.vaadin.external.google:android-json:0.0.20131108.vaadin1 +| +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- org.springframework:spring-test:5.0.9.RELEASE +| | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| \--- org.xmlunit:xmlunit-core:2.5.1 +\--- org.junit.jupiter:junit-jupiter-engine:5.0.1 + +--- org.junit.platform:junit-platform-engine:1.0.1 + | +--- org.junit.platform:junit-platform-commons:1.0.1 -> 1.1.1 + | | \--- org.apiguardian:apiguardian-api:1.0.0 + | \--- org.opentest4j:opentest4j:1.0.0 + \--- org.junit.jupiter:junit-jupiter-api:5.0.1 -> 5.1.1 + +--- org.apiguardian:apiguardian-api:1.0.0 + +--- org.opentest4j:opentest4j:1.0.0 + \--- org.junit.platform:junit-platform-commons:1.1.1 (*) + +testCompileOnly - Compile only dependencies for source set 'test'. +No dependencies + +testImplementation - Implementation only dependencies for source set 'test'. (n) ++--- org.springframework.boot:spring-boot-starter-test (n) +\--- org.junit.jupiter:junit-jupiter-engine:5.0.1 (n) + +testRuntime - Runtime dependencies for source set 'test' (deprecated, use 'testRuntimeOnly' instead). +No dependencies + +testRuntimeClasspath - Runtime classpath of source set 'test'. ++--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot:2.0.5.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE +| | | | \--- org.springframework:spring-jcl:5.0.9.RELEASE +| | | \--- org.springframework:spring-context:5.0.9.RELEASE +| | | +--- org.springframework:spring-aop:5.0.9.RELEASE +| | | | +--- org.springframework:spring-beans:5.0.9.RELEASE +| | | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-expression:5.0.9.RELEASE +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE +| | | \--- org.springframework.boot:spring-boot:2.0.5.RELEASE (*) +| | +--- org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE +| | | +--- ch.qos.logback:logback-classic:1.2.3 +| | | | +--- ch.qos.logback:logback-core:1.2.3 +| | | | \--- org.slf4j:slf4j-api:1.7.25 +| | | +--- org.apache.logging.log4j:log4j-to-slf4j:2.10.0 +| | | | +--- org.slf4j:slf4j-api:1.7.25 +| | | | \--- org.apache.logging.log4j:log4j-api:2.10.0 +| | | \--- org.slf4j:jul-to-slf4j:1.7.25 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.yaml:snakeyaml:1.19 +| +--- org.springframework.boot:spring-boot-starter-aop:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | \--- org.aspectj:aspectjweaver:1.8.13 +| +--- org.springframework.boot:spring-boot-starter-jdbc:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- com.zaxxer:HikariCP:2.7.9 +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | \--- org.springframework:spring-jdbc:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-tx:5.0.9.RELEASE +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- javax.transaction:javax.transaction-api:1.2 +| +--- org.hibernate:hibernate-core:5.2.17.Final +| | +--- org.jboss.logging:jboss-logging:3.3.1.Final -> 3.3.2.Final +| | +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final -> 1.0.2.Final +| | +--- org.javassist:javassist:3.22.0-GA -> 3.23.1-GA +| | +--- antlr:antlr:2.7.7 +| | +--- org.jboss:jandex:2.0.3.Final +| | +--- com.fasterxml:classmate:1.3.0 -> 1.3.4 +| | +--- dom4j:dom4j:1.6.1 +| | \--- org.hibernate.common:hibernate-commons-annotations:5.0.1.Final +| | \--- org.jboss.logging:jboss-logging:3.3.0.Final -> 3.3.2.Final +| +--- org.springframework.data:spring-data-jpa:2.0.10.RELEASE +| | +--- org.springframework.data:spring-data-commons:2.0.10.RELEASE +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.slf4j:slf4j-api:1.7.25 +| | +--- org.springframework:spring-orm:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | | +--- org.springframework:spring-jdbc:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-tx:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | \--- org.slf4j:slf4j-api:1.7.25 +| \--- org.springframework:spring-aspects:5.0.9.RELEASE +| \--- org.aspectj:aspectjweaver:1.8.13 ++--- org.springframework.boot:spring-boot-starter-validation -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| \--- org.hibernate.validator:hibernate-validator:6.0.12.Final +| +--- javax.validation:validation-api:2.0.1.Final +| +--- org.jboss.logging:jboss-logging:3.3.2.Final +| \--- com.fasterxml:classmate:1.3.4 ++--- org.springframework.boot:spring-boot-starter-web -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| | +--- org.springframework:spring-web:5.0.9.RELEASE +| | | +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| | | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| | +--- com.fasterxml.jackson.core:jackson-databind:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | \--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6 +| | | +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 +| | | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6 +| | +--- com.fasterxml.jackson.core:jackson-core:2.9.6 +| | \--- com.fasterxml.jackson.core:jackson-databind:2.9.6 (*) +| +--- org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE +| | +--- javax.annotation:javax.annotation-api:1.3.2 +| | +--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| | +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34 +| | \--- org.apache.tomcat.embed:tomcat-embed-core:8.5.34 +| +--- org.hibernate.validator:hibernate-validator:6.0.12.Final (*) +| +--- org.springframework:spring-web:5.0.9.RELEASE (*) +| \--- org.springframework:spring-webmvc:5.0.9.RELEASE +| +--- org.springframework:spring-aop:5.0.9.RELEASE (*) +| +--- org.springframework:spring-beans:5.0.9.RELEASE (*) +| +--- org.springframework:spring-context:5.0.9.RELEASE (*) +| +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- org.springframework:spring-expression:5.0.9.RELEASE (*) +| \--- org.springframework:spring-web:5.0.9.RELEASE (*) ++--- javax.xml.bind:jaxb-api:2.3.1 +| \--- javax.activation:javax.activation-api:1.2.0 ++--- org.javassist:javassist:3.23.1-GA ++--- com.h2database:h2 -> 1.4.197 ++--- org.springframework.boot:spring-boot-starter-test -> 2.0.5.RELEASE +| +--- org.springframework.boot:spring-boot-starter:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-test:2.0.5.RELEASE +| | \--- org.springframework.boot:spring-boot:2.0.5.RELEASE (*) +| +--- org.springframework.boot:spring-boot-test-autoconfigure:2.0.5.RELEASE +| | +--- org.springframework.boot:spring-boot-test:2.0.5.RELEASE (*) +| | \--- org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE (*) +| +--- com.jayway.jsonpath:json-path:2.4.0 +| | +--- net.minidev:json-smart:2.3 +| | | \--- net.minidev:accessors-smart:1.2 +| | | \--- org.ow2.asm:asm:5.0.4 +| | \--- org.slf4j:slf4j-api:1.7.25 +| +--- junit:junit:4.12 +| | \--- org.hamcrest:hamcrest-core:1.3 +| +--- org.assertj:assertj-core:3.9.1 +| +--- org.mockito:mockito-core:2.15.0 +| | +--- net.bytebuddy:byte-buddy:1.7.9 -> 1.7.11 +| | +--- net.bytebuddy:byte-buddy-agent:1.7.9 -> 1.7.11 +| | \--- org.objenesis:objenesis:2.6 +| +--- org.hamcrest:hamcrest-core:1.3 +| +--- org.hamcrest:hamcrest-library:1.3 +| | \--- org.hamcrest:hamcrest-core:1.3 +| +--- org.skyscreamer:jsonassert:1.5.0 +| | \--- com.vaadin.external.google:android-json:0.0.20131108.vaadin1 +| +--- org.springframework:spring-core:5.0.9.RELEASE (*) +| +--- org.springframework:spring-test:5.0.9.RELEASE +| | \--- org.springframework:spring-core:5.0.9.RELEASE (*) +| \--- org.xmlunit:xmlunit-core:2.5.1 +\--- org.junit.jupiter:junit-jupiter-engine:5.0.1 + +--- org.junit.platform:junit-platform-engine:1.0.1 + | +--- org.junit.platform:junit-platform-commons:1.0.1 -> 1.1.1 + | | \--- org.apiguardian:apiguardian-api:1.0.0 + | \--- org.opentest4j:opentest4j:1.0.0 + \--- org.junit.jupiter:junit-jupiter-api:5.0.1 -> 5.1.1 + +--- org.apiguardian:apiguardian-api:1.0.0 + +--- org.opentest4j:opentest4j:1.0.0 + \--- org.junit.platform:junit-platform-commons:1.1.1 (*) + +testRuntimeOnly - Runtime only dependencies for source set 'test'. (n) +No dependencies + +(*) - dependencies omitted (listed previously) + +(n) - Not resolved (configuration is not meant to be resolved) + +A web-based, searchable dependency report is available by adding the --scan option. + +BUILD SUCCESSFUL in 1s +1 actionable task: 1 executed diff --git a/spring-boot/validation/gradlew b/spring-boot/validation/gradlew new file mode 100644 index 0000000..4453cce --- /dev/null +++ b/spring-boot/validation/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/spring-boot/validation/gradlew.bat b/spring-boot/validation/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/spring-boot/validation/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/spring-boot/validation/settings.gradle b/spring-boot/validation/settings.gradle new file mode 100644 index 0000000..b2ccb11 --- /dev/null +++ b/spring-boot/validation/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'validation' diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/Input.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/Input.java new file mode 100644 index 0000000..5ad3250 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/Input.java @@ -0,0 +1,41 @@ +package io.reflectoring.validation; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.Pattern; + +@Entity +public class Input { + + @Id + @GeneratedValue + private Long id; + + @Min(1) + @Max(10) + private int numberBetweenOneAndTen; + + // Note that this is actually not a valid IP address pattern, since + // it allows values greater than 255 per octet. + @Pattern(regexp = "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$") + private String ipAddress; + + public int getNumberBetweenOneAndTen() { + return numberBetweenOneAndTen; + } + + public void setNumberBetweenOneAndTen(int numberBetweenOneAndTen) { + this.numberBetweenOneAndTen = numberBetweenOneAndTen; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/InputWithCustomValidator.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/InputWithCustomValidator.java new file mode 100644 index 0000000..4036fd5 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/InputWithCustomValidator.java @@ -0,0 +1,56 @@ +package io.reflectoring.validation; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; + +import io.reflectoring.validation.service.OnCreate; +import io.reflectoring.validation.service.OnUpdate; + +@Entity +public class InputWithCustomValidator { + + @Id + @GeneratedValue + @NotNull(groups = OnUpdate.class) + @Null(groups = OnCreate.class) + private Long id; + + @Min(1) + @Max(10) + @Column + private int numberBetweenOneAndTen; + + @IpAddress + @Column + private String ipAddress; + + public int getNumberBetweenOneAndTen() { + return numberBetweenOneAndTen; + } + + public void setNumberBetweenOneAndTen(int numberBetweenOneAndTen) { + this.numberBetweenOneAndTen = numberBetweenOneAndTen; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/IpAddress.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/IpAddress.java new file mode 100644 index 0000000..e051732 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/IpAddress.java @@ -0,0 +1,25 @@ +package io.reflectoring.validation; + +import javax.validation.Constraint; +import javax.validation.Payload; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Target({ FIELD }) +@Retention(RUNTIME) +@Constraint(validatedBy = IpAddressValidator.class) +@Documented +public @interface IpAddress { + + String message() default "{IpAddress.invalid}"; + + Class[] groups() default { }; + + Class[] payload() default { }; + +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/IpAddressValidator.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/IpAddressValidator.java new file mode 100644 index 0000000..02bb2dc --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/IpAddressValidator.java @@ -0,0 +1,32 @@ +package io.reflectoring.validation; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class IpAddressValidator implements ConstraintValidator { + + @Override + public boolean isValid(String value, ConstraintValidatorContext context) { + Pattern pattern = Pattern.compile("^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$"); + Matcher matcher = pattern.matcher(value); + try { + if (!matcher.matches()) { + return false; + } else { + for (int i = 1; i <= 4; i++) { + int octet = Integer.valueOf(matcher.group(i)); + if (octet > 255) { + return false; + } + } + return true; + } + } catch (Exception e) { + return false; + } + } + +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/ValidationApplication.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/ValidationApplication.java new file mode 100644 index 0000000..955d68e --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/ValidationApplication.java @@ -0,0 +1,12 @@ +package io.reflectoring.validation; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ValidationApplication { + + public static void main(String[] args) { + SpringApplication.run(ValidationApplication.class, args); + } +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/ErrorHandlingControllerAdvice.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/ErrorHandlingControllerAdvice.java new file mode 100644 index 0000000..1b07112 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/ErrorHandlingControllerAdvice.java @@ -0,0 +1,39 @@ +package io.reflectoring.validation.controller.controlleradvice; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; + +import org.springframework.http.HttpStatus; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ControllerAdvice +class ErrorHandlingControllerAdvice { + + @ExceptionHandler(ConstraintViolationException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseBody + ValidationErrorResponse onConstraintValidationException(ConstraintViolationException e) { + ValidationErrorResponse error = new ValidationErrorResponse(); + for (ConstraintViolation violation : e.getConstraintViolations()) { + error.getViolations().add(new Violation(violation.getPropertyPath().toString(), violation.getMessage())); + } + return error; + } + + @ExceptionHandler(MethodArgumentNotValidException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ResponseBody + ValidationErrorResponse onMethodArgumentNotValidException(MethodArgumentNotValidException e) { + ValidationErrorResponse error = new ValidationErrorResponse(); + for (FieldError fieldError : e.getBindingResult().getFieldErrors()) { + error.getViolations().add(new Violation(fieldError.getField(), fieldError.getDefaultMessage())); + } + return error; + } + +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/ValidationErrorResponse.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/ValidationErrorResponse.java new file mode 100644 index 0000000..ec294ac --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/ValidationErrorResponse.java @@ -0,0 +1,17 @@ +package io.reflectoring.validation.controller.controlleradvice; + +import java.util.ArrayList; +import java.util.List; + +public class ValidationErrorResponse { + + private List violations = new ArrayList<>(); + + public List getViolations() { + return violations; + } + + public void setViolations(List violations) { + this.violations = violations; + } +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/Violation.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/Violation.java new file mode 100644 index 0000000..f344651 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/controller/controlleradvice/Violation.java @@ -0,0 +1,21 @@ +package io.reflectoring.validation.controller.controlleradvice; + +public class Violation { + + private final String fieldName; + + private final String message; + + public Violation(String fieldName, String message) { + this.fieldName = fieldName; + this.message = message; + } + + public String getFieldName() { + return fieldName; + } + + public String getMessage() { + return message; + } +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/repository/ValidatingRepository.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/repository/ValidatingRepository.java new file mode 100644 index 0000000..7031c2c --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/repository/ValidatingRepository.java @@ -0,0 +1,7 @@ +package io.reflectoring.validation.repository; + +import io.reflectoring.validation.Input; +import org.springframework.data.repository.CrudRepository; + +public interface ValidatingRepository extends CrudRepository { +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/repository/ValidatingRepositoryWithCustomValidator.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/repository/ValidatingRepositoryWithCustomValidator.java new file mode 100644 index 0000000..3636890 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/repository/ValidatingRepositoryWithCustomValidator.java @@ -0,0 +1,7 @@ +package io.reflectoring.validation.repository; + +import io.reflectoring.validation.InputWithCustomValidator; +import org.springframework.data.repository.CrudRepository; + +public interface ValidatingRepositoryWithCustomValidator extends CrudRepository { +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/service/OnCreate.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/OnCreate.java new file mode 100644 index 0000000..0e84491 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/OnCreate.java @@ -0,0 +1,4 @@ +package io.reflectoring.validation.service; + +public interface OnCreate { +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/service/OnUpdate.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/OnUpdate.java new file mode 100644 index 0000000..7821ef8 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/OnUpdate.java @@ -0,0 +1,4 @@ +package io.reflectoring.validation.service; + +public interface OnUpdate { +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ProgrammaticallyValidatingService.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ProgrammaticallyValidatingService.java new file mode 100644 index 0000000..338f1d9 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ProgrammaticallyValidatingService.java @@ -0,0 +1,38 @@ +package io.reflectoring.validation.service; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.Validation; +import javax.validation.Validator; +import javax.validation.ValidatorFactory; + +import java.util.Set; + +import io.reflectoring.validation.Input; +import org.springframework.stereotype.Service; + +@Service +public class ProgrammaticallyValidatingService { + + private Validator validator; + + public ProgrammaticallyValidatingService(Validator validator) { + this.validator = validator; + } + + public void validateInput(Input input) { + ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + Validator validator = factory.getValidator(); + Set> violations = validator.validate(input); + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } + + public void validateInputWithInjectedValidator(Input input) { + Set> violations = validator.validate(input); + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ValidatingService.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ValidatingService.java new file mode 100644 index 0000000..e9180f1 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ValidatingService.java @@ -0,0 +1,17 @@ +package io.reflectoring.validation.service; + +import javax.validation.Valid; + +import io.reflectoring.validation.Input; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +@Service +@Validated +class ValidatingService { + + void validateInput(@Valid Input input){ + // do something + } + +} diff --git a/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ValidatingServiceWithGroups.java b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ValidatingServiceWithGroups.java new file mode 100644 index 0000000..47199c4 --- /dev/null +++ b/spring-boot/validation/src/main/java/io/reflectoring/validation/service/ValidatingServiceWithGroups.java @@ -0,0 +1,23 @@ +package io.reflectoring.validation.service; + +import javax.validation.Valid; + +import io.reflectoring.validation.InputWithCustomValidator; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +@Service +@Validated +class ValidatingServiceWithGroups { + + @Validated(OnCreate.class) + void validateForCreate(@Valid InputWithCustomValidator input){ + // do something + } + + @Validated(OnUpdate.class) + void validateForUpdate(@Valid InputWithCustomValidator input){ + // do something + } + +} diff --git a/spring-boot/validation/src/main/resources/ValidationMessages.properties b/spring-boot/validation/src/main/resources/ValidationMessages.properties new file mode 100644 index 0000000..93501ea --- /dev/null +++ b/spring-boot/validation/src/main/resources/ValidationMessages.properties @@ -0,0 +1 @@ +IpAddress.invalid=Invalid IP Address: "${validatedValue}"! \ No newline at end of file diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/IpAddressValidatorTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/IpAddressValidatorTest.java new file mode 100644 index 0000000..498c86b --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/IpAddressValidatorTest.java @@ -0,0 +1,16 @@ +package io.reflectoring.validation; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +class IpAddressValidatorTest { + + @Test + void test(){ + IpAddressValidator validator = new IpAddressValidator(); + assertTrue(validator.isValid("111.111.111.111", null)); + assertFalse(validator.isValid("111.foo.111.111", null)); + assertFalse(validator.isValid("111.111.256.111", null)); + } + +} \ No newline at end of file diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/ProgrammaticallyValidatingServiceTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/ProgrammaticallyValidatingServiceTest.java new file mode 100644 index 0000000..1ddd49e --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/ProgrammaticallyValidatingServiceTest.java @@ -0,0 +1,42 @@ +package io.reflectoring.validation; + +import javax.validation.ConstraintViolationException; + +import io.reflectoring.validation.service.ProgrammaticallyValidatingService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import static org.junit.jupiter.api.Assertions.*; + +@ExtendWith(SpringExtension.class) +@SpringBootTest +class ProgrammaticallyValidatingServiceTest { + + @Autowired + private ProgrammaticallyValidatingService service; + + @Test + void whenInputIsInvalid_thenThrowsException(){ + Input input = new Input(); + input.setNumberBetweenOneAndTen(0); + input.setIpAddress("invalid"); + + assertThrows(ConstraintViolationException.class, () -> { + service.validateInput(input); + }); + } + + @Test + void givenInjectedValidator_whenInputIsInvalid_thenThrowsException(){ + Input input = new Input(); + input.setNumberBetweenOneAndTen(0); + input.setIpAddress("invalid"); + + assertThrows(ConstraintViolationException.class, () -> { + service.validateInputWithInjectedValidator(input); + }); + } + +} \ No newline at end of file diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/ValidationApplicationTests.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/ValidationApplicationTests.java new file mode 100644 index 0000000..35778b8 --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/ValidationApplicationTests.java @@ -0,0 +1,16 @@ +package io.reflectoring.validation; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ValidationApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/controller/parameters/ValidateParametersControllerTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/controller/parameters/ValidateParametersControllerTest.java new file mode 100644 index 0000000..e758065 --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/controller/parameters/ValidateParametersControllerTest.java @@ -0,0 +1,38 @@ +package io.reflectoring.validation.controller.parameters; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.MockMvc; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +@ExtendWith(SpringExtension.class) +@WebMvcTest(controllers = ValidateParametersController.class) +class ValidateParametersControllerTest { + + @Autowired + private MockMvc mvc; + + @Test + void whenPathVariableIsInvalid_thenReturnsStatus400() throws Exception { + mvc.perform(get("/validatePathVariable/3")) + .andExpect(status().isBadRequest()); + } + + @Test + void whenRequestParameterIsInvalid_thenReturnsStatus400() throws Exception { + mvc.perform(get("/validateRequestParameter") + .param("param", "3")) + .andExpect(status().isBadRequest()); + } + + @Test + void whenPathVariableIsValid_thenReturnsStatus200() throws Exception { + mvc.perform(get("/validatePathVariable/10")) + .andExpect(status().isOk()); + } + +} \ No newline at end of file diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/controller/requestbody/ValidateRequestBodyControllerTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/controller/requestbody/ValidateRequestBodyControllerTest.java new file mode 100644 index 0000000..527be80 --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/controller/requestbody/ValidateRequestBodyControllerTest.java @@ -0,0 +1,76 @@ +package io.reflectoring.validation.controller.requestbody; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.reflectoring.validation.Input; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; +import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +@ExtendWith(SpringExtension.class) +@WebMvcTest(controllers = ValidateRequestBodyController.class) +class ValidateRequestBodyControllerTest { + + @Autowired + private MockMvc mvc; + + @Autowired + private ObjectMapper objectMapper; + + @Test + void whenInputIsInvalid_thenReturnsStatus400() throws Exception { + Input input = invalidInput(); + String body = objectMapper.writeValueAsString(input); + + mvc.perform(post("/validateBody") + .contentType("application/json") + .content(body)) + .andExpect(status().isBadRequest()); + } + + private Input invalidInput() { + Input input = new Input(); + input.setIpAddress("invalid"); + input.setNumberBetweenOneAndTen(99); + return input; + } + + @Test + void whenInputIsInvalid_thenReturnsStatus400WithErrorObject() throws Exception { + Input input = invalidInput(); + String body = objectMapper.writeValueAsString(input); + + MvcResult result = mvc.perform(post("/validateBody") + .contentType("application/json") + .content(body)) + .andExpect(status().isBadRequest()) + .andReturn(); + + assertThat(result.getResponse().getContentAsString()).contains("violations"); + } + + @Test + void whenInputIsValid_thenReturnsStatus200() throws Exception { + Input input = validInput(); + String body = objectMapper.writeValueAsString(input); + + mvc.perform(post("/validateBody") + .contentType("application/json") + .content(body)) + .andExpect(status().isOk()); + } + + private Input validInput() { + Input input = new Input(); + input.setIpAddress("255.255.255.255"); + input.setNumberBetweenOneAndTen(10); + return input; + } + +} \ No newline at end of file diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/repository/ValidatingRepositoryTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/repository/ValidatingRepositoryTest.java new file mode 100644 index 0000000..5ae568b --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/repository/ValidatingRepositoryTest.java @@ -0,0 +1,42 @@ +package io.reflectoring.validation.repository; + +import javax.persistence.EntityManager; +import javax.validation.ConstraintViolationException; + +import io.reflectoring.validation.Input; +import io.reflectoring.validation.repository.ValidatingRepository; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import static org.junit.jupiter.api.Assertions.*; + +@ExtendWith(SpringExtension.class) +@DataJpaTest +class ValidatingRepositoryTest { + + @Autowired + private ValidatingRepository repository; + + @Autowired + private EntityManager entityManager; + + @Test + void whenInputIsInvalid_thenThrowsException() { + Input input = invalidInput(); + + assertThrows(ConstraintViolationException.class, () -> { + repository.save(input); + entityManager.flush(); + }); + } + + private Input invalidInput() { + Input input = new Input(); + input.setNumberBetweenOneAndTen(0); + input.setIpAddress("invalid"); + return input; + } + +} diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/repository/ValidatingRepositoryWithCustomValidatorTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/repository/ValidatingRepositoryWithCustomValidatorTest.java new file mode 100644 index 0000000..49b94ce --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/repository/ValidatingRepositoryWithCustomValidatorTest.java @@ -0,0 +1,44 @@ +package io.reflectoring.validation.repository; + +import javax.persistence.EntityManager; +import javax.validation.ConstraintViolationException; + +import io.reflectoring.validation.InputWithCustomValidator; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import static org.assertj.core.api.Java6Assertions.assertThat; + +@ExtendWith(SpringExtension.class) +@DataJpaTest +class ValidatingRepositoryWithCustomValidatorTest { + + @Autowired + private ValidatingRepositoryWithCustomValidator repository; + + @Autowired + private EntityManager entityManager; + + @Test + void whenInputIsInvalid_thenThrowsException() { + InputWithCustomValidator input = invalidInput(); + try { + repository.save(input); + entityManager.flush(); + Assertions.fail("expected ConstraintViolationException"); + } catch (ConstraintViolationException e) { + assertThat(e.getConstraintViolations()).hasSize(2); + } + } + + private InputWithCustomValidator invalidInput() { + InputWithCustomValidator input = new InputWithCustomValidator(); + input.setNumberBetweenOneAndTen(0); + input.setIpAddress("invalid"); + return input; + } + +} diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/service/ValidatingServiceTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/service/ValidatingServiceTest.java new file mode 100644 index 0000000..51ba600 --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/service/ValidatingServiceTest.java @@ -0,0 +1,43 @@ +package io.reflectoring.validation.service; + +import javax.validation.ConstraintViolationException; + +import io.reflectoring.validation.Input; +import io.reflectoring.validation.service.ValidatingService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@ExtendWith(SpringExtension.class) +@SpringBootTest +class ValidatingServiceTest { + + @Autowired + private ValidatingService service; + + @Test + void whenInputIsValid_thenThrowsNoException(){ + Input input = new Input(); + input.setNumberBetweenOneAndTen(5); + input.setIpAddress("111.111.111.111"); + + service.validateInput(input); + + // then no exception + } + + @Test + void whenInputIsInvalid_thenThrowsException(){ + Input input = new Input(); + input.setNumberBetweenOneAndTen(0); + input.setIpAddress("invalid"); + + assertThrows(ConstraintViolationException.class, () -> { + service.validateInput(input); + }); + } + +} \ No newline at end of file diff --git a/spring-boot/validation/src/test/java/io/reflectoring/validation/service/ValidatingServiceWithGroupsTest.java b/spring-boot/validation/src/test/java/io/reflectoring/validation/service/ValidatingServiceWithGroupsTest.java new file mode 100644 index 0000000..6193e3f --- /dev/null +++ b/spring-boot/validation/src/test/java/io/reflectoring/validation/service/ValidatingServiceWithGroupsTest.java @@ -0,0 +1,45 @@ +package io.reflectoring.validation.service; + +import javax.validation.ConstraintViolationException; + +import io.reflectoring.validation.InputWithCustomValidator; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import static org.junit.jupiter.api.Assertions.*; + +@ExtendWith(SpringExtension.class) +@SpringBootTest +class ValidatingServiceWithGroupsTest { + + @Autowired + private ValidatingServiceWithGroups service; + + @Test + void whenInputIsInvalidForCreate_thenThrowsException() { + InputWithCustomValidator input = validInput(); + input.setId(42L); + assertThrows(ConstraintViolationException.class, () -> { + service.validateForCreate(input); + }); + } + + private InputWithCustomValidator validInput() { + InputWithCustomValidator input = new InputWithCustomValidator(); + input.setNumberBetweenOneAndTen(1); + input.setIpAddress("111.111.111.111"); + return input; + } + + @Test + void whenInputIsInvalidForUpdate_thenThrowsException() { + InputWithCustomValidator input = validInput(); + input.setId(null); + assertThrows(ConstraintViolationException.class, () -> { + service.validateForUpdate(input); + }); + } + +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-contract-consumer/out/production/classes/io/reflectoring/IdObject.class b/spring-cloud/spring-cloud-contract-consumer/out/production/classes/io/reflectoring/IdObject.class deleted file mode 100644 index f9b5ea6..0000000 Binary files a/spring-cloud/spring-cloud-contract-consumer/out/production/classes/io/reflectoring/IdObject.class and /dev/null differ diff --git a/spring-cloud/spring-cloud-contract-consumer/out/production/classes/io/reflectoring/User.class b/spring-cloud/spring-cloud-contract-consumer/out/production/classes/io/reflectoring/User.class deleted file mode 100644 index 246e16e..0000000 Binary files a/spring-cloud/spring-cloud-contract-consumer/out/production/classes/io/reflectoring/User.class and /dev/null differ diff --git a/tools/jacoco/build.gradle b/tools/jacoco/build.gradle index af5ac6f..2af5fd0 100644 --- a/tools/jacoco/build.gradle +++ b/tools/jacoco/build.gradle @@ -39,30 +39,43 @@ build.finalizedBy jacocoTestReport jacocoTestCoverageVerification { violationRules { - rule { - element = 'CLASS' - limit { - counter = 'LINE' - value = 'COVEREDRATIO' - minimum = 1.0 + + rule { + element = 'METHOD' + limit { + counter = 'LINE' + value = 'COVEREDRATIO' + minimum = 1.0 + } + excludes = [ + 'io.reflectoring.coverage.part.PartlyCovered.partlyCovered(java.lang.String, boolean)', + ] } - excludes = [ - 'io.reflectoring.coverage.part.PartlyCovered', - 'io.reflectoring.coverage.ignored.*', - 'io.reflectoring.coverage.part.NotCovered' - ] - } - rule { - element = 'CLASS' - includes = [ - 'io.reflectoring.coverage.part.PartlyCovered' - ] - limit { - counter = 'LINE' - value = 'COVEREDRATIO' - minimum = 0.8 - } - } + +// rule { +// element = 'CLASS' +// limit { +// counter = 'LINE' +// value = 'COVEREDRATIO' +// minimum = 1.0 +// } +// excludes = [ +// 'io.reflectoring.coverage.part.PartlyCovered', +// 'io.reflectoring.coverage.ignored.*', +// 'io.reflectoring.coverage.part.NotCovered' +// ] +// } +// rule { +// element = 'CLASS' +// includes = [ +// 'io.reflectoring.coverage.part.PartlyCovered' +// ] +// limit { +// counter = 'LINE' +// value = 'COVEREDRATIO' +// minimum = 0.8 +// } +// } } }