未在spring会话中创建会话

lyfkaqu1  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(249)

目前,我正在使用springboot测试spring会话
当我将Spring Security 添加到依赖项时,会话通常会创建并存储在spring\u session表中,但是如果我删除Spring Security 依赖项,则不会创建会话,也不会保存在spring\u session表中。
我当前的设置如下。

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.session:spring-session-jdbc'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    compileOnly 'org.postgresql:postgresql'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}
spring:
  profiles:
    active: local
---
server:
  servlet:
    session:
      timeout: 3600
spring:
  config:
    activate:
      on-profile: local
  datasource:
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://localhost/dummy
    username: post
    password: post
  jpa:
    hibernate:
      ddl-auto: create-drop
  session:
    store-type: jdbc
    jdbc:
      initialize-schema: always

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题