728x90 필터6 spring security 필터 다중 설정 @Order로 순서 설정 package io.security.basicsecurity; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configur.. 2021. 12. 2. 스프링 서블릿 예외처리에 대한 로그 필터(필터 중복 호출 설정) 스프링 빈 등록 DispatcherType을 지정 package hello.exception; import hello.exception.filter.LogFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import javax.servlet.DispatcherType; import java.. 2021. 10. 2. 스프링 서블릿 필터 - 로그인 인증 체크 필터 package hello.login; import hello.login.web.filter.LogFilter; import hello.login.web.filter.LoginCheckFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.servlet.Filter; @Configuration public class WebConfig { @Bean public FilterRegistrationBean.. 2021. 9. 30. 스프링 서블릿 필터 - 요청 로그 필터 chain.doFilter 무조건 해줘야한다. 안해주면 웹 동작 안함 package hello.login.web.filter; import lombok.extern.slf4j.Slf4j; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.util.UUID; @Slf4j public class LogFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { log.info("log filter init"); } @Overrid.. 2021. 9. 30. 스프링 로그인(쿠키, 세션) 로그인 컨트롤러 import hello.login.domain.login.LoginService; import hello.login.domain.member.Member; import hello.login.web.SessionConst; import hello.login.web.session.SessionManager; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.anno.. 2021. 9. 30. 컴포넌트 스캔 필터 (@ComponentScan) includeFilters : 컴포넌트 대상에 포함 excludeFilters : 컴포넌트 대상에 제외 컴포넌트 스캔 테스트 public class ComponentFilterAppConfigTest { @Test void filterScan() { ApplicationContext ac = new AnnotationConfigApplicationContext(ComponentFilterAppConfig.class); BeanA beanA = ac.getBean("beanA", BeanA.class); Assertions.assertThat(beanA).isNotNull(); org.junit.jupiter.api.Assertions.assertThrows( NoSuchBeanDefinitionExcep.. 2021. 8. 12. 이전 1 다음 728x90