목록Spring (17)
hrming
Spring Security를 Form login 처리 시, ① 화면단에서는 아래처럼 form 태그에 action에 아래와 같이 url을 설정하고 method를 "post"로 설정함 ② 하지만 UserCtrl에는 아래와 같이 GetMapping만 있음 @Controller @RequestMapping("/user") public class UserCtrl { @Autowired private UserService userService; @GetMapping("/login") public String userLogin() { return "login"; } ③ 그럼 위의 form 태그에 있는 'post' 는 어떻게 작동하는거지??? 😡 😡 😡 라는 의문이 생겼다. 구글링해보니, Spring Security..
1. pom.xml - dependencies 추가 With Maven, you need to add two extra entries (one for the application and one for testing) to the element in pom.xml, as the following listing shows: org.springframework.boot spring-boot-starter-security org.thymeleaf.extras thymeleaf-extras-springsecurity6 3.1.1.RELEASE org.springframework.security spring-security-test test 2. WebSecurityConfig Class 생성 The followi..
① Validator 클래스를 작성한 후, ② Controller단에서 BindingResult를 사용해 에러 체크 & 그에 따른 처리 Validation by Using Spring’s Validator Interface The next example provides validation behavior for the Person class by implementing the following two methods of the org.springframework.validation.Validator interface: - supports(Class): Can this Validator validate instances of the supplied Class? - validate(Object, org.sp..
@Component @Component is an annotation that allows Spring to detect our custom beans automatically. In other words, without having to write any explicit code, Spring will: Scan our application for classes annotated with @Component Instantiate them and inject any specified dependencies into them Inject them wherever needed However, most developers prefer to use more specialized stereotype annotat..
예전에 공부할 때, DTO랑 VO의 차이점이 이해가 잘 안갔었는데 아래 블로그에 내용이 잘 정리되어 있는 것 같다. 메모메모 ✏ https://tecoble.techcourse.co.kr/post/2020-06-11-value-object/ VO(Value Ojbect)란 무엇일까? 프로그래밍을 하다 보면 VO라는 이야기를 종종 듣게 된다. VO와 함께 언급되는 개념으로는 Entity, DTO등이 있다. 그리고 더 나아가서는 도메인 주도 설계까지도 함께 언급된다. 이 글에서는 우선 다 tecoble.techcourse.co.kr
Bean : Spring Container가 관리하는 객체 (XML문서를 만들고 그 안에 빈 태그를 사용해서 빈을 정의하면, Spring Container가 이를 읽어들여서 빈에 정의된 클래스 객체를 만듦) : 자바의 객체, Spring container에 의해 자바 객체가 만들어 지게 되면서 이 객체를 스프링 빈이라고 부르게 된것이지만 스프링 빈과 일반 객체와의 차이점은 별다르게 없음. Spring container 에서 만들어지는 객체를 스프링 빈이라고 부를 뿐이다. Spring Bean을 사용하는 이유 자주 사용하는 객체를 singleton으로 만들어 놓고 어디서든 불러쓸 수 있도록 하기 위함. 의존성 주입은 간단히 말해 모듈간의 결합도를 낮추어 클래스를 수정해야하는 상황을 줄여주며 이 과정에서 S..
AOP(Aspect Oriented Programming) : 관점 지향 프로그래밍, 횡단 관심사, cross cutting concerns : 부가 기능(advice)를 동적으로 추가해주는 기술 : 메서드의 시작 또는 끝에 자동으로 코드(advice)를 추가 1. AOP관련 용어 용어 설명 target advice가 추가될 객체 advice target에 동적으로 추가될 부가 기능(코드) join point advice가 추가(join)될 대상(메서드) pointcut join point들을 정의한 패턴. 예) execution(* com.fastcampus.*.*(..)) proxy target에 advice가 동적으로 추가되어 생성된 객체 weaving target에 advice를 추가해서 prox..
JAVA REFLECTION API란, 구체적인 클래스 타입을 알지 못해도 그 클래스의 정보(메서드, 타입, 변수 등등)에 접근할 수 있게 해주는 자바 API다. 자세한 내용은 하기 블로그 참고하기! 출처1: https://tecoble.techcourse.co.kr/post/2020-07-16-reflection-api/ Reflection API 간단히 알아보자. Spring Framework를 학습하다 보면 Java Reflection API를 자주 접하게 된다. 하지만 Reflection API… tecoble.techcourse.co.kr 출처2: 스프링의 정석 예제