踩坑日记:エラーが名「enableRedisKeyspaceNotificationsInitializer」が定義されたクラス内でBeanを作成します

離れて何か他のものから、春のセッションとの最初の接触をRedisの、CSDN上のさまざまなチュートリアルを見て開始するには、Ctrl + cのすべての種類。
まずのpom.xml、2つの依存関係、Aのみボーエンリストの多くを追加

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.session</groupId>
    <artifactId>spring-session-data-redis</artifactId>
</dependency>

次に、コンフィギュレーション・ファイルapplication.properties。

spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=123
spring.redis.database=0

ピット:ここでパスワードインストールはデフォルトパスワードが空白でRedisの、その後、以下のこのOKにするので、空欄には、パスワードの塗りつぶしをRedisのない場合。

spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=
spring.redis.database=0

最後に、春のブート起動クラスのアプリケーションの追加コメント@EnableRedisHttpSession

@SpringBootApplication
@EnableRedisHttpSession
public class Application extends WebMvcConfigurationSupport {

    public static void main(String[] args){

        SpringApplication.run(Application.class,args);

    }
}

終わり!

公開された24元の記事 ウォン称賛11 ビュー5424

おすすめ

転載: blog.csdn.net/weixin_44037376/article/details/96839369