본문 바로가기
728x90

자바43

다중 transactionManager - 방법 1 그리고 Service 클래스의 메서드에 선언된 @Transactional 부분도 명시적으로 트랜잭션 매니져를 설정 해야 합니다. ※ “transactionManager” 빈 아이디를 사용할 경우 지정할 필요가 없습니다. @Transactional public void createDatasource1() { //logic…. } @Transactional(value=”txManager2”) public void createDatasource2() { //logic…. } - 방법2 2024. 3. 20.
Spring AOP Spring AOP 는 static method 에서는 작동을 안한다. Subject line basically says it all. I have a static method I want to intercept so that around advice can be applied to it. I can get this to work with any non-static methods but I'm unsure how to allow static methods to be intercepted. --> You can't do that with Spring AOP, because it is proxy based. You have to use AspectJ. Take a look at this simple exam.. 2024. 3. 20.
@Async가 먹히지 않는 경우는 3가지 1) @Autowired가 아닌 new로 했을 경우 2) 같은 Class 내에 있는 Method에서 @Async Method를 호출 하였을 때 결론 : 다른 클래스에 메소드를 만들고 @Autowired 를 이용하여 호출한다. 3) public 메소드에만 적용해야한다 4) 설정 추가 http://springboot.tistory.com/38 2024. 3. 20.
AES-256 실제로 프로젝트에서 사용하기 위해 만들었던 코드로 org.apache.commons.codec 라이브러리에 의존성을 가지고 있다. AES256Util 객체를 생성할때에는 암호화/복호화에 사용될 키를 입력받는다. 스프링 빈컨테이너에 키를 넣어 생성해서 사용하기 위해서 만들었으나 쉽게 생성자를 수정하고 맴버변수를 등록하도록 수정하여 사용할 수도 있다, 단 키의 길이가 16자리 이하일 경우 오류가 발생한다. 개발전 준비단계에 언급한 local_policy.jar 파일과 US_export_policy.jar 추가 다운로드한 라이브러리가 없을 경우에는 16자리의 키를 입력하더라고 java.security.InvalidKeyException: Illegal key size이 발생한다. import java.io.U.. 2024. 3. 20.
알고리즘 // 알파벳으로 시작하고 _ 숫자 영문자만 허용하는 8-30 길이의 단어 String pattern = "^[a-zA-Z][a-zA-Z_0-9]{7,29}$"; String input = ""; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(input); if (m.find()) { System.out.println("Valid"); } else { System.out.println("Invalid"); } ------ // 파일확장자 String pattern = "^\\S+.(?i)(txt|pdf|hwp|xls)$"; String input = "abc.txt"; boolean i = Pattern.matches(pattern, input).. 2024. 3. 20.
728x90