Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
0-wook committed Feb 19, 2024
1 parent ae6be3f commit a8b090d
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package kr.co.automl.global.config.web;

import kr.co.automl.domain.user.dto.SessionUser;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpSession;

import org.springframework.core.MethodParameter;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;

import javax.servlet.http.HttpSession;
import kr.co.automl.domain.user.dto.SessionUser;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Component
public class LoginUserArgumentResolver implements HandlerMethodArgumentResolver {

private final HttpSession httpSession;


/**
* 현재 파라미터를 resolver가 지원할지에 대해 판단
* 현재 파라미터를 resolver가 지원할지에 대해 판단
*/
@Override
public boolean supportsParameter(MethodParameter parameter) {
Expand All @@ -33,7 +33,8 @@ public boolean supportsParameter(MethodParameter parameter) {
* 실제 바인딩할 객체 리턴
*/
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
return httpSession.getAttribute("user");
}
}

0 comments on commit a8b090d

Please sign in to comment.