restcontroller中的会话id

63lcw9qa  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(275)

在我的 RestController 我在用

  1. RequestContextHolder.getRequestAttributes().getSessionId()

获取会话id。对于来自同一浏览器的不同请求(不同的端点),返回的会话id是不同的。
我需要从ui做些什么来在用户会话的后端使用相同的会话id吗(我正在使用react redux for ui) application.properties :

  1. ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
  2. spring.datasource.url = jdbc:mysql://localhost:3306/some_db?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false&allowPublicKeyRetrieval=true
  3. spring.datasource.username = root
  4. spring.datasource.password = something
  5. spring.datasource.initialization-mode=always
  6. spring.session.store-type=JDBC
  7. spring.session.jdbc.initialize-schema=always
  8. spring.session.timeout.seconds=36000
  9. ## Hibernate Properties
  10. # The SQL dialect makes Hibernate generate better SQL for the chosen database
  11. spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
  12. # Hibernate ddl auto (create, create-drop, validate, update)
  13. spring.jpa.hibernate.ddl-auto = update
  14. server.port = 8089
  15. logging.level.root=DEBUG
  16. server.ssl.enabled=true
  17. # The format used for the keystore. It could be set to JKS in case it is a JKS file
  18. server.ssl.key-store-type=PKCS12
  19. # The path to the keystore containing the certificate
  20. server.ssl.key-store=classpath:keystore/xyz.p12
  21. # The password used to generate the certificate
  22. server.ssl.key-store-password=something
  23. # The alias mapped to the certificate
  24. server.ssl.key-alias=something

暂无答案!

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

相关问题