To give a short answer - CDI intentionally provides no API to dynamically add extensions. And in fact, you shouldn't be trying to achieve that.
A bit of why:
CDI is static in it's nature - it needs certain information during bootstrap and extension is one of them. Once that bootstrap is done, the extension mostly become useless (granted, you can still use them as beans and have some logic there, but it's 'just a bean' then). The reason is that extensions hook into bootstrap cycle and can affect each and every phase (ProcessAnnotatedType
, ProcessBeanAttributes
, ...).
Now, if you somehow loaded such an extension later on (e.g. with booted CDI container) there would be two options; either re-load whole CDI container to take this extension into consideration, or ignore it's contents entirely, making it totally useless as it would act as an ordinary bean (the container lifecycle observer would never get invoked). The former would be very costly/disturbing in certain deployment and might lead to unpredictable results - imagine such dynamic extensions shuffling with alternatives and specialization. The latter case makes little to no sense as it would add a never used bean. That's why CDI doesn't allow this in general.
I wonder, what is your use case? If we knew that, perhaps we might help you sort that out in a different way.