代码之家  ›  专栏  ›  技术社区  ›  Zmur

从属性文件向@EnableJdbcHttpSession传递整数

  •  0
  • Zmur  · 技术社区  · 6 年前

    如何从中传递整数参数 application.yml @EnableJdbcHttpSession 注释属性?

    @EnableJdbcHttpSession(tableName = "${some.string.property}")
    

    但如果是这样写的,则显示意外类型:

    @EnableJdbcHttpSession(maxInactiveIntervalInSeconds = "${some.Integer.property}")
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Vedran Pavic    6 年前

    占位符解析仅支持 tableName 属性 @EnableJdbcHttpSession (见 related JdbcHttpSessionConfiguration code ).

    application.yml ,如果您使用的是Spring Boot,则可以省略 @启用JDBCHttpSession

    spring.session.jdbc.cleanup-cron=0 * * * * * # Cron expression for expired session cleanup job.
    spring.session.jdbc.initialize-schema=embedded # Database schema initialization mode.
    spring.session.jdbc.schema=classpath:org/springframework/session/jdbc/schema-@@platform@@.sql # Path to the SQL file to use to initialize the database schema.
    spring.session.jdbc.table-name=SPRING_SESSION # Name of the database table used to store sessions.
    

    参见弹簧靴 reference manual 更多细节。