-
Notifications
You must be signed in to change notification settings - Fork 104
The RESTeasy validation doesn't work with packaging war #75
Comments
Could you please share in GitHub a modified version of sample-app with bean validations that work as JAR and a modified version of sample-app with bean validations that does NOT work as WAR? |
Hi, Case Spring-Boot standaloneThis the logs if I start like standalone:Server: An this the logs for Client to standalone Spring-Boot:[27-07 20:58:54.970][main] D o.a.h.wire:72 - >> "POST /sample-app/echo HTTP/1.1[\r][\n]" RequestHeader: Response: {"exception":null,"fieldViolations":[],"propertyViolations":[],"classViolations":[],"parameterViolations":[{"constraintType":"PARAMETER","path":"echo.arg0","message":"darf nicht leer sein","value":""}],"returnValueViolations":[]} Case Spirng-Boot webThis the logs if i starts like web:21:03:06.148 [localhost-startStop-1] INFO org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@27df5aed: startup date [Thu Jul 27 21:03:06 CEST 2017]; root of context hierarchy An this the logs for Client to standalone Spring-Boot:[27-07 21:03:21.269][main] D o.a.h.i.c.DefaultClientConnection:276 - Sending request: POST /sample-app/echo HTTP/1.1 end here should be a 400, but not we receive 200 |
Hi, |
"Web spring boot" means that runs on tomcat (or other servlet container)? $ gradle clean build
|
Hey @miguelsauza , What @avaysberg means by "web spring boot" is when you build your Spring Boot app as WAR and deploy it to a regular standalone servlet container, instead of running it as a Spring Boot micro-service out of its executable jar (with the container embedded to it).[ Running Spring Boot apps as WARs is documented in Spring Boot document. |
Hello @avaysberg , Thanks for sharing a modified version of sample-app with bean validations. Based on that, I added Bean Validations to the starter sample-app and also to its integration tests (see #75). Everything is working as expected. When it comes to a WAR version of sample-app, I assume everything works as expected as well, although I haven't tested it. I noticed that you didn't share your modified version of sample-app with bean validations as a WAR deployment. Could you share it please? Then I can test it and make sure I see the exact same behavior you are seeing. Also, make sure you follow the document below properly. Running Spring Boot apps as WARs is documented in Spring Boot document. |
I have just tested myself a WAR version of sample-app and I got the same wrong result you did, a 200 instead of a 400. I can see though |
This seems to be a legit bug. I have found out that the I will do more investigation on it when I have time and figure out the root cause. Feel free to investigate yourself and share your findings, or even send a PR, if you reach a solution. |
Hi, package com.sample.app;
import org.jboss.resteasy.plugins.validation.ValidatorContextResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ApplicationConfiguration {
@Bean
public ValidatorContextResolver validatorContextResolver() {
return new ValidatorContextResolver();
}
} Thank you for your help. |
Today I spent some time and found out, that the classes with @Provider not load, but ValidatorContextResolver is annotated: |
Thanks @avaysberg , I am taking a look at it now. |
I had to pause this for a while, too busy with work. I will come back to this as soon as possible. |
Hi,
i found out some problem with this module. The RESTeasy validation doesn't work. This happens in case if we use resteasy-spring-boot in web-application (packaging war):
What we make?
If we do the same with jar it work and we receive 400.
Can you us help and say, how we can solve this problem?
The text was updated successfully, but these errors were encountered: