有关何处更好地发布M5错误的任何建议表示赞赏。测试通过最新的1.2.6,在1.3.0.M5失败。重现的步骤:
1. Create a web starter project using 1.3.0.M5
2. Add a simple test method to add a session variable
3. Start the server on either your desktop, or targeted platform (linux)
4. Hit the endpoint a few times.
5. restart the container.
6. hit it again, note the counter continues on
以下任何内容都足以进行测试。使用Boot时想出的另一个提示:始终使用-Djava.io.tmpdir =" target" 。这将使故障排除"隐藏"文件更容易
@RequestMapping("/addSessionVar")
public String addSessionVar( HttpSession session) {
if ( session.getAttribute( SAMPLE_SESSION_VAR ) == null ) session.setAttribute( SAMPLE_SESSION_VAR, new AtomicInteger(0) );
AtomicInteger val = (AtomicInteger ) session.getAttribute( SAMPLE_SESSION_VAR ) ;
int curValue = val.incrementAndGet() ;
logger.info( "Updated session variable {} : {}", SAMPLE_SESSION_VAR, curValue ) ;
return "Updated session variable " + SAMPLE_SESSION_VAR + " to: " + curValue ;
}
答案 0 :(得分:0)
配置会话持久性的属性为server.session.persistent
,而不是server.session.persist
。它默认为false
,除非你在类路径上有Spring Boot的DevTools。
如果您发现行为与此不一致请open an issue。