Spring 129

AOP

X정리X 제어해주는거라서 핸들러에 만들어야 할 것 같지만 config에 만들자. AOP는 관점지향 프로그래밍 내가 슈퍼에 갈 수도있고 회사에 갈 수도 있는데 옷을 입는 메서드를 만들 것이다. 항상 슈퍼, 회사에 가는 젤 첫 로직에 옷 입기가 필요하다. 메서드를 따로 분리해서 재사용하면 되겠네? 동일하게 동작(동일한 코드)하는 로직이라면 그냥 메서드에 추가하면 된다. AOP를 사용하면 AController의 모든 메서드들은 .. 접근 지정자가 public인 메서드들은 .. 하면서 설정이 가능ㅎㅏ다. 이는 리플렉션 기능으로 가능한것. 반복로직을 들고있어서 번거롭게 적어주지 않아도 되지만 얘만 가지고 AOP라고 하지 않는다. 이는 핵심로직에 집중하게 해준다는 첫번째 AOP의 특징이다. A컨트롤러의 모든 메서드..

Spring/Tistory 2022.06.21

RestDoc 테스트

1. plugin 추가 id "org.asciidoctor.jvm.convert" version "3.3.2" 2. 라이브러리 추가 testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' 3. tasks.named 삭제 4. 테스트 후 snippetsDir 변수에 담긴 폴더에 저장할거임 아직 build라는 폴더 없음! 테스트 후 결과를 담는다 이것도 grooby 언어임 ext { snippetsDir = file('build/generated-snippets') } test { outputs.dir snippetsDir useJUnitPlatform() } asciidoctor { dependsOn test inputs.dir ..

Spring 2022.06.15

스프링부트 단위테스트시(JUnit)에 추상 클래스 설정하기 (RestDoc + Security)

package site.metacoding.restdoc; import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.restdocs.RestDocumentationContextProvider; import org.springframework.restdocs.RestDocumentationExtension; import org.springframework.restdoc..

Spring 2022.06.15