-
Notifications
You must be signed in to change notification settings - Fork 41.2k
NoSuchCacheManagerFailureAnalyzer #13916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8d59b76
to
51fe5da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @nosan
I've made a few suggestions. I also wonder if this isn't a special case of NoSuchBeanDefinitionFailureAnalyzer
. If a CacheManager
could not be auto-configured, I'd like to see the auto-configurations pieces that couldn't apply and the conditions that weren't met.
I certainly wouldn't want to copy/paste that logic and I think it'd be worth researching.
Thoughts?
* @see EnableCaching | ||
* @since 1.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please refrain from doing unrelated changes.
...igure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.java
Show resolved
Hide resolved
* Exception thrown when {@link org.springframework.cache.CacheManager} implementation | ||
* are not specified. | ||
*/ | ||
static class NoCacheManagerException extends RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To mirror NoSuchBeanDefinitionException
, you could call that NoSuchCacheManagerException
* implementations are available with no way to know which implementation should be | ||
* used. | ||
*/ | ||
static class NonUniqueCacheManagerException extends RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one could be NoUniqueCacheManagerException
extending from the other exception (again to mirror NoUniqueBeanDefinitionException
)
* @author Dmytro Nosan | ||
* @since 2.1.0 | ||
*/ | ||
class NoCacheManagerFailureAnalyzer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to merge the FailureAnalyzer
so that we only have one class (and an instance check to determine the type). This is my main motivation for having a hierarchy in the two exceptions at hand.
@@ -1007,6 +1018,16 @@ public CacheResolver cacheResolver() { | |||
|
|||
} | |||
|
|||
@Configuration | |||
static class AdditionalCacheManagerAutoConfiguration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not an auto-configuration and shouldn't be named like that. It shouldn't be added as an auto-config in the test either.
2a4aa4b
to
fa1c719
Compare
@snicoll Thank you. |
@nosan thanks for the update. I didn't mean to extend from the framework exception type but to mirror the same naming and hierarchy. The base should extend from Sorry if that wasn't clear. |
@snicoll Frankly speaking, I really like these two analyzers Thoughts? |
I need to revise this PR. |
@snicoll I've updated this PR. Please take a look :) |
0374b2b
to
a3dc14c
Compare
4a1a22b
to
742ba6e
Compare
Sorry for the long delay, I was a bit busy :( I've updated this PR and fix all conflicts. |
@nosan no need to apologize, I am the one who didn't get a chance to have a deeper look at it yet. Thanks for rebasing! |
beb5766
to
f7039a6
Compare
84a5fa1
to
c11e571
Compare
…implementation to inspect registered beans.
…plementation to inspect "not matches" auto-configurations and beans.
…'CacheManager' is not found/unique.
Thanks for your patience @nosan. I am not keen to bring this amount of complexity for the task at hand. I've created an issue in Framework to improve the exception that is throw in such cases so that we can reuse the existing analyzers or very easily tune a new one for our purposes. Thanks for the PR, in any case. |
@snicoll fair enough, this PR contained a lot of changes. |
see gh-13348