「Spring」ServletContextインスタンスを取得する方法

2021年4月19日

サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
private static ServletContext getContext() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
.getServletContext();
}
private static ServletContext getContext() { return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest() .getServletContext(); }
private static ServletContext getContext() {
    return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
                .getServletContext();
}

 

SpringMVC

Posted by arkgame