@ResourceInfo(subsystem = "usermgmt", name = "api-user", title = "ApiUser", metadataLink = "api-user")
I have an JEE application where I have a number of application-specific annotations to describe certain non-business attributes of entity classes. When the application is launched, all the entity classes are scanned, and a map is populated with entities class based on one of the annotation attributes (metadataLink in this case) which is used to look-up the corresponding class when the webservice need to provide metadata for an entity. Scanning all the packages which can contain entity classes and filling the map is taking around 45 seconds on the target hardware. I would like to reduce this time to only a few seconds or less.
Since this mapping is based on static data, I am hoping to be able to create the mapping data at build time, store it is a file in the WAR (maybe WEB-INF/META-INF/metadata-mappings.properties), and just load this information at run-time, avoiding the sizable delay when launching the application.
I've done type of thing before using a Compile-time Annotation Processor, but I am hoping there is a ready-built Maven plugin which I could use to accomplish this. Has anyone worked on a project with Maven build-time scanning?
I think you'd probably want to create a mojo (which is to say a custom Maven plugin). Mojos are in JavaBean form, but for details I'll refer you to the official Maven docs.
You might also consider doing what Spring Data does, which is to define a package path for your scanner. That's what Spring Data does to identify persistence objects without having to run every class in the application.
Sources may include data from the Fakebook Research Foundation with support from Gargle University