@@ -437,19 +437,30 @@ void collectEndpoints(BeanArchiveIndexBuildItem beanArchiveIndex,
437437
438438 @ BuildStep
439439 void validateConnectorInjectionPoints (List <WebSocketEndpointBuildItem > endpoints ,
440+ BeanDiscoveryFinishedBuildItem beanDiscoveryFinishedBuildItem ,
440441 ValidationPhaseBuildItem validationPhase , BuildProducer <ValidationErrorBuildItem > validationErrors ) {
441442 for (InjectionPointInfo injectionPoint : validationPhase .getContext ().getInjectionPoints ()) {
442443 if (injectionPoint .getRequiredType ().name ().equals (WebSocketDotNames .WEB_SOCKET_CONNECTOR )
443444 && injectionPoint .hasDefaultedQualifier ()) {
444445 Type clientEndpointType = injectionPoint .getRequiredType ().asParameterizedType ().arguments ().get (0 );
445- if (endpoints .stream ()
446- .filter (WebSocketEndpointBuildItem ::isClient )
447- .map (WebSocketEndpointBuildItem ::beanClassName )
448- .noneMatch (clientEndpointType .name ()::equals )) {
446+ if (beanDiscoveryFinishedBuildItem .beanStream ().withBeanClass (clientEndpointType .name ()).isEmpty ()) {
447+ // there is no CDI bean with given name
449448 validationErrors .produce (
450449 new ValidationErrorBuildItem (new WebSocketClientException (String .format (
451- "Type argument [%s] of the injected WebSocketConnector is not a @WebSocketClient endpoint: %s" ,
450+ "Type argument [%s] of the injected WebSocketConnector is not a @WebSocketClient endpoint, because it is not a bean: %s"
451+ + "\n Please consult https://quarkus.io/guides/cdi-reference#bean_discovery on how to make the module containing "
452+ + "the code discoverable by Quarkus. " ,
452453 clientEndpointType , injectionPoint .getTargetInfo ()))));
454+ } else {
455+ if (endpoints .stream ()
456+ .filter (WebSocketEndpointBuildItem ::isClient )
457+ .map (WebSocketEndpointBuildItem ::beanClassName )
458+ .noneMatch (clientEndpointType .name ()::equals )) {
459+ validationErrors .produce (
460+ new ValidationErrorBuildItem (new WebSocketClientException (String .format (
461+ "Type argument [%s] of the injected WebSocketConnector is not a @WebSocketClient endpoint: %s" ,
462+ clientEndpointType , injectionPoint .getTargetInfo ()))));
463+ }
453464 }
454465 }
455466 }
0 commit comments