spring - Building custom java config annotations - similar to custom XML namespaces -


We are building a structure on top of spring & amp; Spring mvc Our structure is quite mature at this time - about 2 years old and widely used within our organization. Our structure is very modular (like very spring), there are many modules which can be used independently or together. When used together, they provide many benefits to the end user. We have created a handful of custom spring xml namespace (namespace handlers, beadiffinist parser etc.). Each module provides itself that brings in its set of XML configuration elements. It's all working great for us and really big win for us.

What we want to do now is away from XML-based configuration and Java config. My thoughts / thought is to present a set of Java config annotations for each module, which can be used (like @EnableCaching , @EnableMBeanExport annotation) My question is this - even if I make my comments - how do I "wire" them so that they are present, can I do "stuff"? This namespace handlers & amp; BeanDefinitionParsers. I can not get any documents anywhere to start.

I have thought of creating some custom abstract base classes which I should do - but the problem is that the end user's application - they can only expand a single class. I need a flexible way for every module in my framework that can be used to expose your custom configuration, which can use end user applications, like they use our XML namespace elements.

Here's a glimpse that we do not have XML (full application reference file - this is linked to our custom XML namespace):

  & lt; Atom-web: web / & gt; & Lt; Nuclear Web: Login / & gt; & Lt; Atom-web: security entitlement provider = "XML" xmlRefreshInterval = "$ {cache.refresh.interval.ms}" /> & Lt; Atom-profile: profile caching = "IN_MEMORY" entry ExpiryDelay = "$ {cache.refresh.interval.ms}" /> & Lt; Atom-prefs: preferences backing STOREUrl = "$ {pref.backingStore.url}" /> & Lt; atom-content: content contentServerBaseUrl = "$ {content.server.url}" contentServerFileUrl = "$ {content.server.file.url}" site = "$ {site.name}" contentTaskExecutor = "contentTaskExecutor" snippet caching = " IN_MEMORY "cacheRefreshInterval =" $ {cache.refresh.interval.ms} "/> & Lt; Bean id = "contentTaskExecutor" class = "org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor" P: Core PoolSize = "3" p: maxPoolSize = "20" />   

Whatever I am thinking is any sort of annotation - something like this:

  @EnableAtomWebApplication @ EnableAtomWebLogging @EnableAtomWebSecurity (Entitlement Provider = EntitlementsProvider.XML, xmlRefreshDelay = 120000) @EnableAtomProfile (caching = caching type. IN_MEMORY, expiryDelay = 120000) // Other comments for the rest module @ Configuration public class ConfigurationClass {// The rest of the configuration here}   

Any help here would be greatly appreciated. I am not sure where to start, and actually can not find any document anywhere to help me.

itemprop = "text">

So after thinking about this, I think I got the correct starting point. I would like to throw it out from there, which might be able to say "whether or not in the right place" or "you are not seeing the right place"

Use my example above >

  @EnableAtomProfile (caching = caching type.IN_MEMORY, expiryDelay = 120000)   

I This way, create an annotation for @ActivatePontofile annotation:

  @Retention (value = java.lang.annotation.RetentionPolicy.RUNTIME) @Target (value = {java.lang.annotation.ElementType. TYPE}) @ Document @ Import ({AtomProfileBeanDefinitionRegistrar.class}) public @interface EnableAtomProfile {caching type caching (default caching type). NOF; Long term deletion default 0; }   

The AtomProfileBeanDefinitionRegistrar class will implement any necessary stuff and I am currently doing it in my

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -