注解里怎么从配置文件里读出int类型的配置,默认读出来的都是String的

下面代码里的 maxInactiveIntervalInSeconds = 3000, 3000怎么写到配置里去,并且拿到的书int类型

@ComponentScan({"com.banda.admin"})
@Configuration
@EnableScheduling
@Import({CommonImportConfig.class})
@EnableRedisHttpSession(
maxInactiveIntervalInSeconds = 3000,
redisNamespace = "spring.session.redis.namespace")
public class AdminConfig extends WebMvcConfigurerAdapter {
.
.
.
}

按如下步骤试试:
1、在类路经下增加个配置文件如config.properties,配置如下:
maxInactiveIntervalInSeconds = 3000

2、需要获取配置的类加上注解

@PropertySource(value = {"classpath:/config.properties"})

3、@Value("${maxInactiveIntervalInSeconds}”)注解获取配置,定义变量类型为Integer即可

@Value("${maxInactiveIntervalInSeconds}")
private Integer maxInactiveIntervalInSeconds;