본문 바로가기

분류 전체보기163

Introduction to the Spring IoC Container and Beans - 스프링 IoC 컨테이너와 Beans 소개 Dependency Injection, 의존성 주입 Dependenct Injection, 의존성 주입은 IoC(Inversion of Control, 제어의 역전)의 특화된 형태입니다. DI를 사용한다면 오브젝트들은 자신들의 의존성(함께 작업을 처리하는 다른 오브젝트들)을 오직 생성자 인수, 팩터리 메서드에 대한 인수, 혹은 객체가 생성되거나 팩토리 메서드에서 반환된 후에 객체 인스턴스에 설정된 속성을 통해서만 의존성을 정의합니다. IoC 컨테이너는 빈을 생성하며 해당 빈에 정의된 의존성을 바탕으로 필요한 의존성을 주입해줍니다. BeanFactory, ApplicationContext org.springframework.beans 패키지와 org.springframework.context 패키지는 스프.. 2024. 1. 21.
Spring Security - @PreAuthorize, @PostAuthorize Method Security 동작방식 Method Security동작 방식 스프링 시큐리티에서 제공하는 Method Security는 다음과 같은 상황에서 유용할 수 있습니다. 세분화된 Authorization 로직 추출 : 예를 들자면, 메서드 파라미터나 반환 값이 Authorization에 영향을 미치는 경우 서비스 레이어에서 보안을 강제하고자 하는 경우 HttpSecurity기반 설정대신 애노테이션 기반으로 처리하고자 하는 경우 Method Security는 스프링 AOP를 사용해 만들어졌기 때문에 필요한 경우 스프링 시큐리티 기본값을 재정의(Override) 하여 사용할 수 있습니다. 💡 `@EnableMethodSecurity`는 Deprecated된 `@EnableGloablMethodSecu.. 2024. 1. 16.
[프로그래머스] 가장 긴 팰린드롬 DP 사용 class Solution { boolean[][] dp; public int solution(String s) { int answer = 0; dp = new boolean[s.length()][s.length()]; for(int i=0;i 2023. 12. 8.
[LeetCode] 501. Find Mode in Binary Search Tree class Solution { public int[] findMode(TreeNode root) { List values = new ArrayList(); dfs(root, values); int maxStreak = 0; int currStreak = 0; int currNum = 0; List ans = new ArrayList(); for (int num : values) { if (num == currNum) { currStreak++; } else { currStreak = 1; currNum = num; } if (currStreak > maxStreak) { ans.clear(); maxStreak = currStreak; } if (currStreak == maxStreak) { ans.a.. 2023. 12. 6.
728x90