• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

filtering component scans (doesn't work)

 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this configuration in my bean.xml



I have a few services in com.example.engine.manager package:
DealManager
BookManager
TransManager

but I wanted to disable some service like DealManager and the rest of services will be still running.
Therefore I put this "exclude-filter" into bean.xml, but it doesn't work.

any wrong with my syntax (i ran it without error though) or any that I don't know?

I tried search with google but the results are not helpful.

Any master here can give me a clue ?

Thanks in advance.
Regards
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I can't help with regex, I don't know regex, nor want to know it. ;)

You can do a couple of approaches. I see that you turned off the default filters which are includes for @Service, @Repository etc.

I do know your order might not make it work, where the first include included your DealManager and therefore the exclude after is overwritten, or maybe the other way around.

One approach I like in this scenario is to create my own set of Annotations and use those in your class and filters where type="Annotations" (Always make sure you include package for your Annotation in the value)

I had three web apps all sharing the same Core project that had Services that in some apps needed and in others didn't. And I couldn't come up with a good filter at that time. Since then and after I left that company, I realized that creating my own Annotation, one for each app, I could put those on those classes and write a clean filter and get exactly the classes I want.

So say I have an app called Moo and another called Bark, I would create an @Moo and a @Bark annotation, I could annotate those annotations with @Service or @Component, then put one or both on Managers that I need in that particular app. Then just



for the Bark application.

That is one possible solution.

Mark
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic