Contents
see List작성일 2015. 11. 05.
1. SpringContextHolder를 이용하는 방법
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
System.out.println(authentication.getName());
2. Controller 의 경우 메서드 인자로 받는 방법
@RequestMapping("/")
public String index(Principal principal) {
System.out.println(principal.getName());
return "index";
}
3. User 클래스로 형변환하여 정보를 조회하는 방법
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
System.out.println(user.getUsername());
spring
| No | 작성일 | Title |
|---|---|---|
| 2123 | 2026. 02. 11. | Spring AI: 스프링에서 LLM 통합하기 |
| 2122 | 2026. 02. 11. | Spring Boot 3.4 신기능과 마이그레이션 가이드 |
| 2013 | 2025. 11. 30. | Spring Cache 추상화 - Redis 캐시 적용 |
| 2012 | 2025. 11. 30. | Spring Validation - Bean Validation 활용 |
| 2011 | 2025. 11. 30. | Spring Profile로 환경별 설정 관리 |
| 2010 | 2025. 11. 30. | Spring AOP로 로깅과 트랜잭션 처리 |
| 2009 | 2025. 11. 30. | Spring Batch 대용량 데이터 처리 |
| 2008 | 2025. 11. 30. | Spring Cloud Gateway로 API Gateway 구축 |
| 2007 | 2025. 11. 30. | Spring WebFlux - 리액티브 프로그래밍 입문 |
| 2006 | 2025. 11. 30. | Spring Data JPA 쿼리 메서드 완벽 가이드 |