Skip to content

Commit

Permalink
Initialize the Cache in a constructor
Browse files Browse the repository at this point in the history
Signed-off-by: jansupol <[email protected]>
  • Loading branch information
jansupol committed May 6, 2021
1 parent a468507 commit fe1c784
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,19 @@ public class CdiInterceptorWrapper {
private final ValidationInterceptor interceptor;

@Inject
public CdiInterceptorWrapper(BeanManager beanManager) {
public CdiInterceptorWrapper(BeanManager beanManager, CdiInterceptorWrapperExtension extension) {
// get the original interceptor from the bean manager directly
// to avoid CDI bootstrap issues caused by wrong extension ordering
final Set<Bean<?>> interceptorBeans = beanManager.getBeans(ValidationInterceptor.class);
final Bean<?> interceptorBean = beanManager.resolve(interceptorBeans);
this.interceptor = (ValidationInterceptor) beanManager.getReference(
interceptorBean, ValidationInterceptor.class, beanManager.createCreationalContext(interceptorBean));

this.extension = extension;
//initialize the cache
extension.getJaxRsResourceCache();
}

@Inject
private CdiInterceptorWrapperExtension extension;

@AroundInvoke
Expand Down

0 comments on commit fe1c784

Please sign in to comment.