Java/Spring Boot6 파일 다운로드(HttpServletResponse, ResponseEntity) Out Of Memory 이슈로 인해 Buffer를 사용하도록 구현되어야 함. Buffer를 사용하지 않고 용량이 큰 파일을 다운로드 하면 파일 사이즈 만큼 메모리가 점유되어 JVM이 강제종료 됨. HttpServletResponse @GetMapping("/file/download") public void fileDownload(HttpServletResponse response) throws Exception { FileSystemResource fileSystemResource = new FileSystemResource("C:\\test\\test.zip"); File file = fileSystemResource.getFile(); String fileName = file.getName(); S.. 2023. 7. 16. Spring Security Xml Config web.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* context-security.xml LoginService.java public class LoginService implements UserDetailsService { @Autowired private UserService userService; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { LoginUser loginUser = new LoginUser(); lo.. 2023. 7. 16. Spring Security Java Config @Slf4j, @Getter, @Setter 는 Lombok 어노테이션임. SpringSecurityConfig.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.Au.. 2023. 7. 16. Spring Security 로그인 된 사용자 정보 가져오기 로그인 된 사용자 정보 가져오기 1. Controller 에서 어노테이션 사용 method(@AuthenticationPrincipal LoginUser user) 2. SecurityContextHolder 사용 LoginUser user = (LoginUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); 3. JSP에서 로그인 사용자 정보 가져오기 ${user.username} ${user} 2023. 7. 16. 이전 1 2 다음 반응형