Skip to content

Commit

Permalink
Change ProcessBeanAttributesNotFiredForBuiltinBean to only detect PBA…
Browse files Browse the repository at this point in the history
… for beans with @default qualifiers
  • Loading branch information
manovotn committed Jun 23, 2023
1 parent 80306ee commit 51733d3
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import jakarta.enterprise.context.Conversation;
import jakarta.enterprise.event.Event;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.Default;
import jakarta.enterprise.inject.Instance;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.Extension;
Expand All @@ -33,26 +34,32 @@ public class ProcessBeanAttributesObserver implements Extension {
private List<ProcessBeanAttributes<?>> observedBeanAttributes = new ArrayList<ProcessBeanAttributes<?>>();

public void observeHttpServletRequestBeanAttributes(@Observes ProcessBeanAttributes<HttpServletRequest> event) {
observedBeanAttributes.add(event);
if (event.getBeanAttributes().getQualifiers().contains(Default.Literal.INSTANCE)) {
observedBeanAttributes.add(event);
}
}

@SuppressWarnings("rawtypes")
public void observeEventBeanAttributes(@Observes ProcessBeanAttributes<Event> event) {
observedBeanAttributes.add(event);
}
if (event.getBeanAttributes().getQualifiers().contains(Default.Literal.INSTANCE)) {
observedBeanAttributes.add(event);
} }

@SuppressWarnings("rawtypes")
public void observeInstanceBeanAttributes(@Observes ProcessBeanAttributes<Instance> event) {
observedBeanAttributes.add(event);
}
if (event.getBeanAttributes().getQualifiers().contains(Default.Literal.INSTANCE)) {
observedBeanAttributes.add(event);
} }

public void observeConversationBeanAttributes(@Observes ProcessBeanAttributes<Conversation> event) {
observedBeanAttributes.add(event);
}
if (event.getBeanAttributes().getQualifiers().contains(Default.Literal.INSTANCE)) {
observedBeanAttributes.add(event);
} }

public void observeBeanManagerBeanAttributes(@Observes ProcessBeanAttributes<BeanManager> event) {
observedBeanAttributes.add(event);
}
if (event.getBeanAttributes().getQualifiers().contains(Default.Literal.INSTANCE)) {
observedBeanAttributes.add(event);
} }

public List<ProcessBeanAttributes<?>> getObservedBeanAttributes() {
return observedBeanAttributes;
Expand Down

0 comments on commit 51733d3

Please sign in to comment.