Skip to content

Question about "The definition is not enabled" IllegalStateException thrown by DefaultBeanContext #10460

Answered by zdegner
zdegner asked this question in Q&A
Discussion options

You must be logged in to vote

I had a theory that setting up the mocks was somehow taking "too long" (9 different when() clauses are setup for the two mocks), triggering a race condition, or somehow interfering with @MockBean, so I moved the setup logic to the test class's constructor and the issue no longer occurs. The constructor logic runs prior to Micronaut's JUnit extension which should make the @MockBean method resolve quicker. It is still not clear to me what is going on behind the scenes, but this completely resolved the issue with "The definition is not enabled".

public abstract class ApiTestWithFormularyAndCalculationEngineMocks extends ApiTestWithDb {
    protected FormularyClient formularyClient;
    prote…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by zdegner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants