Skip to content
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

Ability to disable RedisAutoConfiguration similar to spring.cloud.bus.enabled=false #5386

Closed
donovanmuller opened this issue Mar 10, 2016 · 10 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@donovanmuller
Copy link

To take advantage of Spring Cloud Bus, we use the Redis starter spring-cloud-starter-bus-redis as the bus channel.

It is possible to disable the bus via spring.cloud.bus.enabled=false when running tests or a local no-deps profile for example. However, it does not seem possible to disable RedisAutoConfiguration.

Given that a Redis instance is not running, the app will startup without error but the /health endpoint will complain about Redis being Down. This causes issues if you want to selectively enable service discovery for instance. I.e. you want service discovery on but the bus off etc.

There should be a way to disable RedisAutoConfiguration via something like spring.redis.enabled=false or something like that.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 10, 2016
@snicoll
Copy link
Member

snicoll commented Mar 10, 2016

There are various way to disable the RedisAutoConfiguration, there is an exclude attribute on the @SpringBootApplication and a spring.autoconfigure.exclude property if you can't use that. We've been asked this several times and rejected the feature so far as spring.redis.enabled is just a syntaxic sugar on top of that and we're not keen on having several ways of doing the same thing.

@snicoll snicoll closed this as completed Mar 10, 2016
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 10, 2016
@donovanmuller
Copy link
Author

Ok, spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration works. Thanks

@chb0github
Copy link

chb0github commented Aug 30, 2017

I did as suggested @donovanmuller - that gets me past the cachemanager issue but now I am get NoSuchBeanDefinitionException redisTemplate - this is because redisReferenceResolver is trying to look that up

So, it's still looking for Redis.

@wilkinsona
Copy link
Member

@chb0github Unless my memory is failing me, a bean named redisReferenceResolver isn't part of Spring Boot

@chb0github
Copy link

Looking at my debugger right now, the bean it's trying to hydrate is:
org.springframework.data.redis.core.convert.ReferenceResolverImpl which is coming from spring-data-redis:1.8.0.RELEASE which is coming from this dependency: compile('org.springframework.boot:spring-boot-starter-data-redis') . I admit, the bean name is a bit misleading. The type it actually resolves to is not

The only other reference to redis is in our hibernate support.

@wilkinsona
Copy link
Member

As far as I can tell, there's nothing in Spring Data Redis that creates a ReferenceResolverImpl bean. Without any evidence to the contrary I can only assume that the redisReferenceResolver bean definition is in your own configuration. If that's not the case, please create a sample that reproduces the problem and open a new issue against the appropriate project.

@Stamp1d0
Copy link

@chb0github Exclude RedisRepositoriesAutoConfiguration.class to resolve "no such bean redisTemplate" problem

@chb0github
Copy link

@Stamp1d0 will give that a try. Thanks

@kuangyoubo

This comment has been minimized.

@carrchang

This comment has been minimized.

@spring-projects spring-projects locked as resolved and limited conversation to collaborators May 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

8 participants