Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdi-dev] About parsing beans.xml files in Lite

Hi,

just wanted to finish what I hinted at during the meeting.

I mentioned that in Quarkus we deliberately avoided reading beans.xml so that we don't need to solve the issue of enabling alternatives/interceptors/... in separate bean archives (as opposed to using @Priority which is global).
Instead, we just detect the presence of this file within a JAR and based on its presence we then either scan classes for bean defining annotations, or we don't.
As a matter of fact, we currently pour everything into a singular bean archive (which I have to say I came to like as it makes understanding the meaning of bean archive much simpler for users).

I am not against being able to parse beans.xml contents for some information that might be relevant to Lite setup, but right now I don't think we really have anything like that.
But if we decide to have it, then in the future it might become a universal place for some extra configuration.
Obviously, the name of the marker file could be different, but given that we don't need to store anything in it, beans.xml is well known by now and I don't see reasons not to use that name.

Tomas Langer also correctly mentioned that today you can have beans.xml with discovery mode "none" and therefore the presence of beans.xml can mean you don't want to process that archive.
This is true, although I have to point out that I haven't really seen this used much. It is probably a remnant of CDI 1.0 where default discovery mode was explicit (instead of annotated) and where you needed to always have beans.xml present.

IMO for Lite we are looking for a discovery mode that is as close to annotated as we can get because that is the most natural model for build-time approach and also the default for current CDI.
The ability to use beans.xml as marker file is an optimization cherry on top that allows us to determine whether we want some extra beans from other archive, or whether we want to save time and memory footprint and not process it.

Just wanted to clarify what I meant here, hope its not too long :)
Matej



Back to the top