<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 
        <base href="https://issues.redhat.com"> 
        <title>Message Title</title> 
    </head> 
    <body class="jira" style="color: #333333; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.429"> 
        <table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f5f5f5; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt" bgcolor="#f5f5f5"> 
            <!-- header here --> 
            <tbody>
                <tr> 
                    <td id="header-pattern-container" style="padding: 0px; border-collapse: collapse; padding: 10px 20px"> 
                        <table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                            <tbody>
                                <tr> 
                                    <td id="header-avatar-image-container" valign="top" style="padding: 0px; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 8px" width="32"> <img id="header-avatar-image" class="image_fix" src="https://static.jboss.org/developer/gravatar/7badf6e89094b134dd4eb65792b7f734?d=mm&amp;s=48" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top"> </td> 
                                    <td id="header-text-container" valign="middle" style="padding: 0px; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> <a class="user-hover" rel="vampire" id="email_vampire" href="https://issues.redhat.com/secure/ViewProfile.jspa?name=vampire" style="color:#0066cc;; color: #3b73af; text-decoration: none">Björn Kautler</a> <strong>commented</strong> on <a href="https://issues.redhat.com/browse/WELD-2608" style="color: #3b73af; text-decoration: none"><img src="cid:jira-generated-image-avatar-36c46789-7144-4e5a-aeb2-a9dbbd8d5b84" height="16" width="16" border="0" align="absmiddle" alt="Bug"> WELD-2608</a> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="email-content-container" style="padding: 0px; border-collapse: collapse; padding: 0 20px"> 
                        <table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0; border-collapse: separate"> 
                            <tbody>
                                <tr> 
                                    <!-- there needs to be content in the cell for it to render in some clients --> 
                                    <td class="email-content-rounded-top mobile-expand" style="padding: 0px; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 15px; background-color: #ffffff; border-left: 1px solid #cccccc; border-top: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px; height: 10px; line-height: 10px; padding: 0 15px 0 16px; mso-line-height-rule: exactly" height="10" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> 
                                        <table class="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                            <tbody>
                                                <tr> 
                                                    <td style="vertical-align: top;; padding: 0px; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" class="page-title-pattern-header-container"> <span class="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"> <a href="https://issues.redhat.com/browse/WELD-2608" style="color: #3b73af; text-decoration: none">Re: Adding a bean using AfterBeanDiscovery does not register its observer methods</a> </span> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td id="text-paragraph-pattern-top" class="email-content-main mobile-expand  comment-top-pattern" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff; border-bottom: none; padding-bottom: 0" bgcolor="#ffffff"> 
                                        <table class="text-paragraph-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 2px"> 
                                            <tbody>
                                                <tr> 
                                                    <td class="text-paragraph-pattern-container mobile-resize-text " style="padding: 0px; border-collapse: collapse; padding: 0 0 10px 0"> 
                                                        <blockquote style="margin: 10px 0 0 0; margin-top: 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"> 
                                                            <p style="margin: 10px 0 0 0; margin-top: 0">No, the exclusions are done on a per-archive basis, same as you would enable alternatives/interceptors via beans.xml.<br> And in SE you either have discovery and beans.xml where you can specify it, or you use synthetic bean archive where you have full control over what gets inside, therefore you don't really need filters.</p>
                                                        </blockquote> <p style="margin: 10px 0 0 0">Well, not really.<br> I do</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px 3px 3px 3px; border-radius: 3px 3px 3px 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-groovy" style="margin: 10px 0 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
<span class="code-keyword" style="color: #000091">def</span> seContainer = SeContainerInitializer.newInstance()
    .addProperty(<span class="code-quote" style="color: #009100">'javax.enterprise.inject.scan.implicit'</span>, TRUE)
    .initialize()
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0 0">and due to the classes and resources being in different directories on the class path,<br> <tt>beans.xml</tt> would only be an option if I manipulate the runtime environment for the tests,<br> so that classes and resources are in the same directory, or at least the <tt>beans.xml</tt> in the classes directory.</p> 
                                                        <blockquote style="margin: 10px 0 0 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"> 
                                                            <p style="margin: 10px 0 0 0; margin-top: 0">&gt; Why "plus some suffix"?</p> 
                                                            <p style="margin: 10px 0 0 0">Habit I guess... just so that you don't collide with some default, even though that's extremely unlikely. The random you posted is fine, you could also go with some common suffix for all classes you register such as clazz.getName() + " _manuallyRegistered". Anything, really.</p>
                                                        </blockquote> <p style="margin: 10px 0 0 0">Ok, thanks.</p> 
                                                        <blockquote style="margin: 10px 0 0 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"> 
                                                            <p style="margin: 10px 0 0 0; margin-top: 0">&gt; That was more a sad gibe, that addAnnotatedType(AnnotatedType&lt;?&gt;, String) should better also return an AnnotatedTypeConfigurator</p> 
                                                            <p style="margin: 10px 0 0 0">There are use cases where registering whole AnnotatedType is preferable to just using configurator. It is actually more powerful, but far more complex.</p>
                                                        </blockquote> <p style="margin: 10px 0 0 0">If you have an <tt>AnnotatedType</tt> anyway and just want to modify some details like adding or removing annotations.<br> Of course one can simply use the <tt>addAnnotatedType(Class&lt;?&gt;, String)</tt> to get the configurator,<br> but why not simply also return a configurator there to be able to manipulate the result?</p> <p style="margin: 10px 0 0 0">Anyway, that was just a side-note, I'm fine with using the <tt>Class</tt> version.</p> 
                                                        <blockquote style="margin: 10px 0 0 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"> 
                                                            <p style="margin: 10px 0 0 0; margin-top: 0">&gt; From what I read there, the @Vetoed beans should also trigger a ProcessAnnotatedType event and I could remove the @Vetoed annotation there.</p> 
                                                            <p style="margin: 10px 0 0 0">What Martin said is right, with @Vetoed you'd need to register the AT manually through BeforeBeanDiscovery.addAnnotatedType().</p>
                                                        </blockquote> <p style="margin: 10px 0 0 0">Yep, 11.5.6 that Martin quoted makes it clear.<br> But then imho 12.4.1 that I quoted needs to mention <tt>@Vetoed</tt> too, as it states this:</p> 
                                                        <blockquote style="margin: 10px 0 0 0; border-left: 1px solid #cccccc; color: #707070; margin-left: 19px; padding: 10px 20px"> 
                                                            <p style="margin: 10px 0 0 0; margin-top: 0">First the container must discover types. The container discovers:</p> 
                                                            <ul class="alternate" type="square"> 
                                                                <li>each Java class, interface (excluding the special kind of interface declaration annotation type) or enum deployed in an explicit bean archive, and</li> 
                                                                <li>each Java class with a bean defining annotation in an implicit bean archive.<br> that is not excluded from discovery by an exclude filter as defined in Exclude filters.</li> 
                                                            </ul> 
                                                            <p style="margin: 10px 0 0 0">Then, for every type discovered the container must create an AnnotatedType representing the type and fire an event of type ProcessAnnotatedType, as defined in ProcessAnnotatedType event.</p>
                                                        </blockquote> <p style="margin: 10px 0 0 0">Which made me think it should be fired even with <tt>@Vetoed</tt>.</p> 
                                                        <hr> <p style="margin: 10px 0 0 0">So, as configuring the exclusion is not possible (except by manipulating the runtime environment to be able to use <tt>beans.xml</tt>),<br> I see two options left, which would you say is better / preferable / has an advantage over the other?</p> <p style="margin: 10px 0 0 0">1. Having <tt>@Alternative</tt> on the beans in question and then using</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px 3px 3px 3px; border-radius: 3px 3px 3px 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-groovy" style="margin: 10px 0 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
ProcessAnnotatedType#configureAnnotatedType().remove { it.annotationType() == Alternative }
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0 0"> for the beans to be used and</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px 3px 3px 3px; border-radius: 3px 3px 3px 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-groovy" style="margin: 10px 0 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
ProcessAnnotatedType#veto()
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0 0">for the others or </p> <p style="margin: 10px 0 0 0">2. Having <tt>@Vetoed</tt> on the beans in question and then using</p> 
                                                        <div class="code panel" style="border-width: 1px;; border: 1px solid #cccccc; background: #f5f5f5; font-size: 12px; line-height: 1.333; font-family: monospace; border: 1px solid #cccccc; -moz-border-radius: 3px 3px 3px 3px; border-radius: 3px 3px 3px 3px; margin: 9px 0">
                                                            <div class="codeContent panelContent" style="padding: 9px 12px"> 
                                                                <pre class="code-groovy" style="margin: 10px 0 0 0; margin-top: 0; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal">
BeforeBeanDiscovery#addAnnotatedType(clazz, <span class="code-quote" style="color: #009100">"$clazz.name ${randomUUID()}"</span>).remove { it.annotationType() == Vetoed }
</pre> 
                                                            </div>
                                                        </div> <p style="margin: 10px 0 0 0"> for the beans to be used</p> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <tr> 
                                    <td class="email-content-main mobile-expand " style="padding: 0px; border-collapse: collapse; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; border-top: 0; border-bottom: 0; padding: 0 15px 0 16px; background-color: #ffffff" bgcolor="#ffffff"> 
                                        <table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="actions-pattern-container" valign="middle" style="padding: 0px; border-collapse: collapse; padding: 10px 0 10px 24px; vertical-align: middle; padding-left: 0"> 
                                                        <table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                                            <tbody>
                                                                <tr> 
                                                                    <td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0; vertical-align: middle"> <a href="https://issues.redhat.com/browse/WELD-2608#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none"> <img class="actions-pattern-action-icon-image" src="cid:jira-generated-image-static-comment-icon-b1580542-ff20-4b96-be32-3836f4bce165" alt="Add Comment" title="Add Comment" height="16" width="16" border="0" style="vertical-align: middle"> </a> </td> 
                                                                    <td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px"> <a href="https://issues.redhat.com/browse/WELD-2608#add-comment" target="_blank" title="Add Comment" style="color: #3b73af; text-decoration: none">Add Comment</a> </td> 
                                                                </tr> 
                                                            </tbody>
                                                        </table> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                                <!-- there needs to be content in the cell for it to render in some clients --> 
                                <tr> 
                                    <td class="email-content-rounded-bottom mobile-expand" style="padding: 0px; border-collapse: collapse; color: #ffffff; padding: 0 15px 0 16px; height: 5px; line-height: 5px; background-color: #ffffff; border-top: 0; border-left: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-right: 1px solid #cccccc; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; mso-line-height-rule: exactly" height="5" bgcolor="#ffffff">&nbsp;</td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
                <tr> 
                    <td id="footer-pattern" style="padding: 0px; border-collapse: collapse; padding: 12px 20px"> 
                        <table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                            <tbody>
                                <tr> 
                                    <td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0px; border-collapse: collapse; color: #999999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px"> This message was sent by Atlassian Jira <span id="footer-build-information">(v7.13.8#713008-<span title="1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6" data-commit-id="1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6}">sha1:1606a5c</span>)</span> </td> 
                                    <td id="footer-pattern-logo-desktop-container" valign="top" style="padding: 0px; border-collapse: collapse; padding-left: 20px; vertical-align: top"> 
                                        <table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt"> 
                                            <tbody>
                                                <tr> 
                                                    <td id="footer-pattern-logo-desktop-padding" style="padding: 0px; border-collapse: collapse; padding-top: 3px"> <img id="footer-pattern-logo-desktop" src="https://issues.redhat.com/images/mail/atlassian-email-logo.png" alt="Atlassian logo" title="Atlassian logo" width="191" height="24" class="image_fix"> </td> 
                                                </tr> 
                                            </tbody>
                                        </table> </td> 
                                </tr> 
                            </tbody>
                        </table> </td> 
                </tr> 
            </tbody>
        </table>   
    </body>
</html>