weld / weld-testing

Set of test framework extensions (JUnit 4, JUnit 5, Spock) to enhance the testing of CDI components via Weld. Supports Weld 5.
http://weld.cdi-spec.org/
Apache License 2.0
102 stars 30 forks source link

Neither @PostConstruct nor constructor get invoked when being injected #173

Closed Pr3roxDLC closed 9 months ago

Pr3roxDLC commented 9 months ago

I have a test set up like this:

@EnableAutoWeld
@ActivateScopes({RequestScoped.class})
public class ExampleTest {

    @Inject
    ConfigurationBuilderProvider configurationBuilderProvider;

    @Test
    void testSomething() {
         ...
    }

}

I now have the problem that neither the @PostConstruct annotated method nor the no-arg constructor get invoked, for any beans that get injected into ConfigurationBuilderProvider, i am guessing that this is a mistake on my side and that i am missing something here. Both ConfigurationBuilderProvider and the Bean injected into it are Annotated with @ApplicationScoped.

Edit: the @PostConstruct annotated method does get invoked in the ConfigurationBuilderProvider class, so just at the top level but not for dependencies further down the tree

Pr3roxDLC commented 9 months ago

Was an error on my side, unrelated to this