[
https://issues.jboss.org/browse/WFLY-11956?page=com.atlassian.jira.plugin...
]
Matěj Novotný commented on WFLY-11956:
--------------------------------------
bq. Matěj Novotný, that's very interesting. I'm wondering, though, if that's a
Weld-specific behavior. The javadoc doesn't seem to guarantee that postConstruct()
will be called.
Well, {{InjectionTarget#postConstruct()}}, according to spec, _calls the @PostConstruct
callback, if it exists_. It kind of makes sense to call this every time and within this
method you figure whether you actually have some of those methods, or make it no-op
otherwise. Cannot guarantee that other impls don't handle it differently though.
@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)