将spring-boot 2.17与hazelcast 3.11和tomcat 9.0.39配合使用。
我已经设置了一个WebFilter bean:
@Bean
public WebFilter webFilter(HazelcastInstance hazelcastInstance) {
Properties properties = new Properties();
properties.put("instance-name", hazelcastInstance.getName());
properties.put("sticky-session", "false");
properties.put("map-name", "httpSessions");
properties.put("cookie-path", "/");
properties.put("cookie-secure", true);
properties.put("cookie-http-only", true);
return new WebFilter(properties);
}但是http不会以secure=true和hazelcast.sessionId -only=true结束。
也许有什么变通的办法?
谢谢
发布于 2020-12-09 22:54:47
您应该将布尔属性与字符串值放在一起:
properties.put("cookie-secure", "true");
properties.put("cookie-http-only", "true");如果你想知道它的原因,这是因为WebFilter内部使用的java.util.Properties#getProperty行为。看起来是这样的:
public String getProperty(String key) {
Object oval = map.get(key);
String sval = (oval instanceof String) ? (String)oval : null;
...
}因此,行为就像你的布尔值是空的。
https://stackoverflow.com/questions/65215107
复制相似问题