Abnaxos / meldioc

A prototype of an IoC (Inversion of Control) library for Java
MIT License
5 stars 1 forks source link

Add attribute to add additional mounts to `Mount` annotation #110

Open Abnaxos opened 2 years ago

Abnaxos commented 2 years ago

I'm not a friend of the mount attribute in the Configuration annotation. They're easy to overlook up there. However, a shortcut for mounting simple features became even more important with the implementation of #104. Some default implementations will be mounted very often.

The problem with the mount attribute could be solved by adding an attribute to the Mount annotation, e.g.:

abstract class MyConfiguration {
  @Mount(support = {MBeanRegistryFeature.UsePlatformMBeanServer.class})
  abstract MBeanRegistryFeature mbeanRegistryFeature();
}

This would move such "utility mounts" to where they're relevant, making them more visible.

The danger is to add another feature to Meld that turns out to be bad, just like the mount attribute was. Then again, we're experimenting here, it may be worth a try.