未在spring会话中创建会话

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

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

  1. dependencies {
  2. implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
  3. implementation 'org.springframework.boot:spring-boot-starter-web'
  4. implementation 'org.springframework.session:spring-session-jdbc'
  5. compileOnly 'org.projectlombok:lombok'
  6. developmentOnly 'org.springframework.boot:spring-boot-devtools'
  7. compileOnly 'org.postgresql:postgresql'
  8. implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
  9. annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
  10. annotationProcessor 'org.projectlombok:lombok'
  11. testImplementation 'org.springframework.boot:spring-boot-starter-test'
  12. testImplementation 'org.springframework.security:spring-security-test'
  13. }
  1. spring:
  2. profiles:
  3. active: local
  4. ---
  5. server:
  6. servlet:
  7. session:
  8. timeout: 3600
  9. spring:
  10. config:
  11. activate:
  12. on-profile: local
  13. datasource:
  14. driver-class-name: org.postgresql.Driver
  15. url: jdbc:postgresql://localhost/dummy
  16. username: post
  17. password: post
  18. jpa:
  19. hibernate:
  20. ddl-auto: create-drop
  21. session:
  22. store-type: jdbc
  23. jdbc:
  24. initialize-schema: always

暂无答案!

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

相关问题