elegos
JCHJava Community | Help. Code. Learn.
•Created by elegos on 11/18/2024 in #java-help
VSCode and RedHat Java: wrong JDK for gradle tasks
Dear community,
I've installed OpenJDK 21. I have configured JAVA_HOME and JDK_HOME accordingly, setup the JDK Runtime under Project Settings (JavaSE-21, which correctly points to the Eclipse Adoptium's jdk 21 folder). The
build.gradle
file is configured to run with Java version 21 (see following config). I have no clue why, when I start the Gradle tasks via the Gradle integration tab, it uses the java.exe included in the redhat's extension (java v. 17).
Running gradlew from the shell, it works correctly (i.e. .\gradlew.bat init
)
Thanks for any help 🙂
Gradle's output:
11 replies
JCHJava Community | Help. Code. Learn.
•Created by elegos on 4/30/2023 in #java-help
Spring boot: unable to instantiate ConstraintValidator: Unsatisfied dependency
I've got the following DTO with its own custom constraint annotation and relative validator:
I've applied to a
@Validated
RestController class method, as follows:
When I try to call the POST mapping, I get the following error:
What am I doing wrong? Thanks!4 replies
JCHJava Community | Help. Code. Learn.
•Created by elegos on 4/30/2023 in #java-help
Spring Boot MVC: validate a multipart/form-data RequestBody
Hello! I have the need to fill a form with some meta data and a file. The meta data required fields depends on the media "type" that you're selecting from a drop-down.
I've thus created a custom validator, associated to a custom annotation and put all on the PostMapping action annotating the parameter with
@Valid @MyCustomAnnotation
(see below). The thing is that the validator is not being called for a reason beyond my knowledge. May you please help me understand what I'm doing wrong?
Thank you very much 🙂
The DTO + validator:
The controller's method:
I've shortened the code as much as possible to stay in the chars limit, please ask me anything which might be related.
Thank you very much!9 replies