dropwizard-auth-multitenancy-example icon indicating copy to clipboard operation
dropwizard-auth-multitenancy-example copied to clipboard

Tenant Cache in MultitenantRequestListener does not make any sense

Open yateam opened this issue 8 years ago • 2 comments

Hello, I read your article here and could not seem to understand why you need a cache of tenants in MultitenancyRequestListener. MultitenancyApplicationListener creates a new instance of RequestListener on every request and the cache exists only during one request. Am I missing something?

yateam avatar Dec 05 '16 09:12 yateam

I agree, it does not make sense for the reason you stated.

I actually don't even know how that got in there, I went back and looked at the production code for our app on which this is based and it is not in that code. I can only imagine I added it on an not-fully-thought-through whim at some point while writing my blog post.

I can try to find time to update the code, but it might be a little while. If you want to open a PR to fix it that would be welcome as well.

scottaj avatar Dec 12 '16 17:12 scottaj

It's not a big deal. I got all I wanted from this sample project. So it's up to you to fix this. I also added a hibernate interceptor, so a tenant id is injected automatically on each save or update operation. This makes code a little bit cleaner and safer.

yateam avatar Dec 12 '16 20:12 yateam