Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We need documentation on how to implement a CDI extension insdie a user feature. #7531

Closed
benjamin-confino opened this issue Sep 5, 2024 · 6 comments
Assignees
Milestone

Comments

@benjamin-confino
Copy link
Member

benjamin-confino commented Sep 5, 2024

Customers have been asking us how to create a CDI Extension inside a user feature. This is a simple process but requires using a SPI unique to OpenLiberty which currently has no documentation other than its javadoc.

This new doc should go under Contexts and Dependency Injection

Draft is at: #7525

Draft publication is at: https://docs-draft-openlibertyio.mqj6zf7jocq.us-south.codeengine.appdomain.cloud/docs/latest/cdi-extension-user-feature.html

@dmuelle dmuelle added this to the 24.0.0.10 milestone Sep 10, 2024
@dmuelle dmuelle self-assigned this Sep 10, 2024
dmuelle added a commit that referenced this issue Sep 13, 2024
@dmuelle dmuelle mentioned this issue Sep 13, 2024
dmuelle added a commit that referenced this issue Sep 16, 2024
@dmuelle dmuelle mentioned this issue Sep 16, 2024
@dmuelle
Copy link
Member

dmuelle commented Sep 16, 2024

HI @benjamin-confino - the draft for this topic is now available for review:

https://docs-draft-openlibertyio.mqj6zf7jocq.us-south.codeengine.appdomain.cloud/docs/latest/cdi-extension-user-feature.html

When you have chance, left me know if any further edits are needed. When you're satisfied with the draft, you can add the technical reviewed label to this issue to sign off. Thanks!

@benjamin-confino
Copy link
Member Author

Hello David, thank you for your work on this. I have a few suggestions:

The CDIExtensionMetadata class also enables the two most...
-->
The CDIExtensionMetadata class provides shortcuts for the two most...

(This one is not a technical issue, so feel free to overrule me on the English)


The CDIAnnotation class becomes a bean defining annotation. Any class that is annotated with @Annotation can be injected through CDI.
---->

The CDIAnnotation class becomes a bean defining annotation. Any class that is annotated with @CDIAnnotation can be injected through CDI.


In this example, each of these methods has a default implementation that returns an empty set, so you can implement only the ones that are relevant to your needs.
--->
Each of these methods has a default implementation that returns an empty set, so you can implement only the ones that are relevant to your needs.

The default methods are not specific to this example but apply to any use of CDIExtensionMetadata


dmuelle added a commit that referenced this issue Sep 17, 2024
@dmuelle
Copy link
Member

dmuelle commented Sep 17, 2024

@dmuelle
Copy link
Member

dmuelle commented Sep 19, 2024

@ramkumar-k-9286 - can you peer review this new topic?

@ramkumar-k-9286
Copy link
Contributor

ramkumar-k-9286 commented Sep 20, 2024

Peer Review

The following example shows an implementation of the CDIExtensionMetadata class, with three possible methods that extend the class.
->
Quick question - The example does not immediately follow this sentence, but it is a bit more class description. Should this sentence be moved to after the classes are explained?

Maybe we can put it like

You can implement CDIExtensionMetadata class, with three possible methods that extend the class.
getBeanClasses.....
getBeanDefiningAnnotationClasses....
getExtensions...
...
The following example shows an implementation of the CDIExtensionMetadata class, with these methods that extend the class.
--codeblock--


@Component(service = CDIExtensionMetadata.class, configurationPolicy = IGNORE)

->
Do spaces exist before and after = in both these cases?


 public Set<Class<?>> getBeanClasses() {

-> Are the { meant to be on the next line? ->

 {
    public Set<Class<?>> getBeanClasses() 
    {
        return Set.of(CDIBean.class);
    }

This configuration is all that you need to make your user extension extend CDI.
->
This configuration is all that you need to make your user extension to extend the CDI.


@dmuelle
Copy link
Member

dmuelle commented Sep 25, 2024

Thanks for reviewing, all changes implemented except:

Java syntax is ok as is
This configuration is all that you need to make your user extension extend CDI.--> ok as is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants