Spring5 AOP AOP(Aspect Oriented Programming) 언제 필요할까? 공통적인 로직(공통 관심 사항) 을 수정하거나 추가할 때! ex) 서비스 로직 전부에 공통된 기능을 추가할 때 AOP 적용 공통 관심 사항(cross-cutting concern) vs 핵심 관심 사항(core concern) 분리 공통 관심 사항을 필요한 곳에 적용 @Aspect annotation을 활용하여 사용 //EXAMPLE @Aspect //@Component => 보통 config에 정의 하여 사용 public class TestAop{ //코드의 수행시간 확인 코드 @Around("execution(* hello.hellospring..*(..))") //hello.hellospring 내부 모두 적용 //@Arou.. 2022. 9. 4. 스프링 빈과 의존관계 @Autowired : 여러번 생성될 필요가 없는 객체들을 스프링컨테이너에서 가져와 연결해 줌. new 생성자를 통해 중복 생성되는 것을 방지. @Component, @Service, @Repository annotation을 추가해 두어야 Component Scan으로 스프링컨테이너에 추가됨.(스프링 빈으로 등록) @SpringBootApplication이 작성된 패키지 하위만 컴포넌트 스캔이 일어남(default) 스프링 빈으로 등록될때는 항상 싱글톤으로 등록된다.(default) 직접 설정파일에서 Spring Bean으로 등록하기 SpringConfigure @Configuration public class SpringConfig{ @Bean public TestService testService(.. 2022. 9. 4. Error를 MatterMost로 받아보자! 결과! 사용환경 SpringBoot(Gradle) MatterMost * 코드이후에 웹훅 받아오는 법 있습니다 - build.gradle //Mattermost annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" implementation 'org.apache.httpcomponents:httpcore:4.4.15' implementation 'org.apache.httpcomponents:httpclient:4.5.13' - Properties.java 알림에 대한 설정을 할 수 있는 페이지 입니다. import lombok.Getter; import lombok.Setter; import org.sprin.. 2022. 4. 29. JAVA 정규식 이용하여 문자열 Filtering하기 String문자열을 replaceAll을 이용하여 변경하는 방식으로 진행하였습니다. // filtering 하려고 하는 문자열 Stirng str = ""; // replaceAll을 이용하여 filtering 하기 String result = str.replaceAll(regex, replacement); regex = filtering 하는 기준(String) replacement = 바꿀 문자열 regex 대괄호( [ ] ) 안의 해당하는 한개의 문자를 의미합니다. ex) [abc] => a혹은 b혹은 c인 하나의 문자 ex) [^def] => d와 e와 f를 제외한 하나의 문자 =>[ ] 내부의 ^ 는 제외를 의미한다. ex) [a-zA-Z0-9] => 0~9, a~z, A~Z 중 하나의 문자 ?.. 2022. 4. 12. 이전 1 2 다음