[
https://issues.jboss.org/browse/WFLY-11956?page=com.atlassian.jira.plugin...
]
Guillaume Smet commented on WFLY-11956:
---------------------------------------
[~ron_sigal] My understanding is that it's not the getter validation that is
triggered. The field and getter form a unique validated entity called a property in HV.
When validating the constructor of a bean, you validate the bean itself as the return
value of the constructor and thus all its properties - so all the fields and getters. It
is not method validation but property validation. That's why your configuration in the
XML file is useless. Getters are already not validated methods by default. But... they are
validated when you validate the properties of a bean.
I'm not sure I'm seeing an easy way to disable this behavior as doing it globally
with a configuration knob seems a bit dangerous as it would also disable it for the domain
objects.
We could probably imagine an entry point specific to CDI to avoid validating the getters
too but I'm not sure how dirty it would be and we would also probably need to keep the
HV metadata generated by this entry point separate.
[~gunnar.morling] any thoughts on that? I'm surprised it only surfaces now tbh as it
seems a potentially very common issue.
@PostConstruct on @ApplicationScoped bean called too late in case
@Valid is annotated on a business method
----------------------------------------------------------------------------------------------------------
Key: WFLY-11956
URL:
https://issues.jboss.org/browse/WFLY-11956
Project: WildFly
Issue Type: Bug
Components: Bean Validation, REST
Affects Versions: 16.0.0.Final
Reporter: Joerg Baesner
Assignee: Ronald Sigal
Priority: Major
Attachments: logging.txt, playground.zip
Having a bean class with {{@ApplicationScoped}}, which has a {{@PostConstruct}} and is
implementing the following _Interface_:
{code}
@Path("/validated")
public interface ValidatedJaxRsInterface {
@GET
@Valid
@Produces(MediaType.APPLICATION_JSON)
GreetingModel getHelloGreeting();
}
{code}
will result in calling the {{getHelloGreeting}} method of the implementation class twice
*_before_* the {{@PostConstruct}} is getting executed.
This can be reproduced with the attached reproducer application...
--
This message was sent by Atlassian Jira
(v7.12.1#712002)