Skip to content

Instantly share code, notes, and snippets.

@arleighdickerson
Created July 13, 2025 16:48
Show Gist options
  • Save arleighdickerson/3a93cba0e7921c260c4d0f47011446ec to your computer and use it in GitHub Desktop.
Save arleighdickerson/3a93cba0e7921c260c4d0f47011446ec to your computer and use it in GitHub Desktop.
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.redis.core.RedisKeyValueAdapter;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.session.data.redis.config.ConfigureRedisAction;
// https://dzone.com/articles/build-a-chat-application-using-spring-boot-websock
// https://engineering.salesforce.com/lessons-learned-using-spring-data-redis-f3121f89bff9
// https://help.heroku.com/5BP0E8RC/how-to-enable-notify-keyspace-events-on-redis
// https://github.com/spring-projects/spring-session/issues/113
// redis-cli config set notify-keyspace-events xEg
// heroku redis:keyspace-notifications REDIS_URL -c 'xEg'
@Configuration
@EnableRedisRepositories(
basePackageClasses = {/* ... */},
enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP,
keyspaceNotificationsConfigParameter = "" // [sic]
)
class RedisRepositoriesConfig {
@SuppressWarnings("SameReturnValue")
@Bean
@Profile("prod")
public ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment