2
我有一個Spring Web應用程序,它在每個請求上創建一個會話,我想避免這種情況。避免在Spring中創建會話
我有這樣的配置:
<security:http pattern="/**" auto-config='true' create-session="never" use-expressions="true">
<security:intercept-url pattern="/**" access="permitAll" />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="dataSource"/>
</security:authentication-provider>
</security:authentication-manager>
我呼籲控制器
@RequestMapping(method=RequestMethod.GET, value="/experiences", produces="application/json")
public String getExperiencesList(
HttpServletRequest request,
@RequestParam(value = "channel",required=true) String channel,
@RequestParam(value = "page",required=true) int page,
Model model) {
String path = "http://" + HOST + request.getContextPath();
model.addAttribute("json", experienceService.getExperiencesList(page,channel,path));
return "json";
}
這將通過移動應用程序使用,同一應用程序可以打開無限的會議,任何想法我怎麼能避免這種情況?
謝謝。
爲什麼你想避免創建會話?是的,有一個不需要的會話確實會造成一些開銷,但會話實際上會導致什麼問題? –
根據上述配置,您的應用程序創建會話,Spring Security將使用它。 – Selva
我們正在製作移動應用程序,並且此服務用於獲取事件列表,如果每個移動設備創建會話都會對服務器造成問題。 – Magec