Skip to content

Commit

Permalink
#4208: implemented getBeanClass in SupplierBeanBridge (see below)
Browse files Browse the repository at this point in the history
The method JersetBean.getBeanClass is used to compute the bean
identifier. The default id for a JerseyBean<T> is
"java.lang.Object#jersey", causing collisions of bridge instances.

In particular, for HelloWorldResourceTest, Weld's MapBeanStore returned
a SupplierInstanceBeanBridge instead of the expected SupplierBeanBridge,
because both shared the same bean identifier.

Signed-off-by: pappy <[email protected]>
  • Loading branch information
pa314159 committed Aug 28, 2019
1 parent 59f4ad1 commit c699bb2
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,9 @@ private static Supplier<?> getSupplier(BeanManager beanManager, ParameterizedTyp
public Class<? extends Annotation> getScope() {
return binding.getScope() == null ? Dependent.class : transformScope(binding.getScope());
}

@Override
public Class<?> getBeanClass() {
return (Class<?>) this.binding.getContracts().iterator().next();
}
}

0 comments on commit c699bb2

Please sign in to comment.