Skip to content

Commit

Permalink
#4208: Implemented getBeanClass in SupplierBeanBridge.
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 8fd814e commit a0e276e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -143,4 +143,11 @@ 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 this.binding.getContracts().isEmpty()
? super.getBeanClass()
: (Class<?>) this.binding.getContracts().iterator().next();
}
}

0 comments on commit a0e276e

Please sign in to comment.