spring-boot-data-geode icon indicating copy to clipboard operation
spring-boot-data-geode copied to clipboard

[OPTIONAL] Add support to log warnings about the use of certain Annotations (e.g. @Indexed) in the absence of the enabling Annotation (e.g. @EnableIndexing).

Open jxblum opened this issue 7 years ago • 1 comments

While this is rather difficult to achieve in practice, it may be worth exploring the possibilities.

One of the challenges in properly detecting the use of certain annotations (e.g. @Indexed) on application domain objects without the associated "enabling" annotation (e.g. @EnableIndexing) is that, by way of example, the application domain model objects containing @Indexed annotations are not even picked up unless the @EnableIndexing annotation is present since that triggers a "scan", which is necessary to 1) limit the scope of the application object types introspected as well as 2) detect whether any @Indexed annotations have been declared. Without the scan, the objects containing the annotations are not even inspected in the first place, so how would the infrastructure know the @Indexed annotation was used without @EnableIndexing, for instance. The "enabling" annotation is needed to begin the scan for the object-level annotations, like @Indexed.

jxblum avatar Jun 01 '18 21:06 jxblum

Of course, if users want to incur the penalty, infrastructure components could be added in SBDG to necessarily scan all the application class types. This might be useful at development time in order to ensure proper behavior of the application at runtime, in production, such as, "we indexed one or more application domain model object(s) properties with @Indexed and we want to make sure our Spring configuration enabled indexing with the @EnableIndexing annotation."

Additional configuration properties used by the supporting infrastructure components could be defined so that the scan could be further limited.

Still, the use of such a feature should be carefully considered since there would be both a 1) resource (memory) penalty in addition to 2) a startup time penalty.

At any rate, further and careful consideration for such a feature in SBDG is needed.

jxblum avatar Feb 24 '22 18:02 jxblum