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

Support programatically customizing SeContainer #2439

Open
mpkorstanje opened this issue Dec 14, 2021 · 1 comment
Open

Support programatically customizing SeContainer #2439

mpkorstanje opened this issue Dec 14, 2021 · 1 comment
Labels
⌛ stale Will soon be closed by stalebot unless there is activity 🙏 help wanted Help wanted - not prioritized by core team ⚡ enhancement Request for new functionality

Comments

@mpkorstanje
Copy link
Contributor

The CdiJakartaFactory creates a container using the SeContainerInitializer.

    private SeContainer container;

    @Override
    public void start() {
        if (container == null) {
            SeContainerInitializer initializer = SeContainerInitializer.newInstance();
            initializer.addExtensions(this);
            container = initializer.initialize();
        }
    }

This starts a CDI application without any customizations. This is less then ideal when testing as certain parts may need to be stubbed out. As solution to this would be similar to #2432 and #1911 where a Backend implementation is used to scan for classes that implement a SeContainerInitializerProvider. The CdiJakartaFactory can then use this provider to create a cutomized initializer.

So as a quick sketch:

package com.example.stepdefinitions;


class MySeContainerInitializerProvider implements ContainerInitializerProvider {

    public SeContainer get() {
           // Provide/ container here
    }
}

Alternatively, or additionally, instead of asking the user to provide the entire container, we can ask the user to customize the existing container.

package com.example.stepdefinitions;


class MySeContainerCustomizer implements SeContainerCustomizer {

    public void customize(SeContainerInitializer sci) {
       // do customizations here    
    }
}

I don't know much about CDI so I think this is best left to the best judgement of people who use CDI.

@mpkorstanje mpkorstanje added 🙏 help wanted Help wanted - not prioritized by core team ⚡ enhancement Request for new functionality labels Dec 14, 2021
@stale
Copy link

stale bot commented Apr 14, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two months if no further activity occurs.

@stale stale bot added the ⌛ stale Will soon be closed by stalebot unless there is activity label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌛ stale Will soon be closed by stalebot unless there is activity 🙏 help wanted Help wanted - not prioritized by core team ⚡ enhancement Request for new functionality
Projects
None yet
Development

No branches or pull requests

1 participant