블로그 이미지

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
  • total
  • today
  • yesterday
2023. 3. 21. 09:50 JAVA오픈소스/Spring
posted by 천상의날개
2022. 8. 23. 14:59 JAVA오픈소스/Spring

  ApplicationContextProvider  
  

  사용법  
  

posted by 천상의날개
2022. 7. 19. 16:33 JAVA오픈소스/Spring

(String) request.getAttribute("javax.servlet.forward.request_uri")

posted by 천상의날개
2020. 7. 13. 16:34 JAVA오픈소스/Spring

HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();

 

http://dveamer.github.io/backend/SpringRequestContextHolder.html

posted by 천상의날개
2020. 5. 28. 16:24 JAVA오픈소스/Spring

로깅할 문자의 {}에 차례대로 값이 들어감

logger.info("test:{} test1:{}","testlg","testlg1")

결과 : test : testlg test1:testlg1

posted by 천상의날개
2016. 12. 20. 15:34 JAVA오픈소스/Spring

public String test(HttpServletRequest request, Model model, @RequestParam MultiValueMap<String, Object> multiParams){

List<Object> ischks = multiParams.get("ischk");
for(int i=0; i < ischks.size() ; i++){

String testCd = multiParams.get("test_cd").get(i);

}

}

posted by 천상의날개
2016. 1. 28. 15:46 JAVA오픈소스/Spring
ApplicationContextManager java
application-context.xml 에 추가
사용법
posted by 천상의날개
2015. 12. 4. 15:18 JAVA오픈소스/Spring

Multiple Transaction Managers with @Transactional

Most Spring applications only need a single transaction manager, but there may be situations where you want multiple independent transaction managers in a single application. The value attribute of the @Transactional annotation can be used to optionally specify the identity of the PlatformTransactionManager to be used. This can either be the bean name or the qualifier value of the transaction manager bean. For example, using the qualifier notation, the following Java code

public class TransactionalService {

    @Transactional("order")
    public void setSomething(String name) { ... }

    @Transactional("account")
    public void doSomething() { ... }
}

could be combined with the following transaction manager bean declarations in the application context.

<tx:annotation-driven/>

    <bean id="transactionManager1" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        ...
        <qualifier value="order"/>
    </bean>

    <bean id="transactionManager2" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        ...
        <qualifier value="account"/>
    </bean>

In this case, the two methods on TransactionalService will run under separate transaction managers, differentiated by the "order" and "account" qualifiers. The default <tx:annotation-driven> target bean name transactionManager will still be used if no specifically qualified PlatformTransactionManager bean is found.

 

참조 URL : https://www.lesstif.com/pages/viewpage.action?pageId=20774954

posted by 천상의날개
2015. 12. 4. 15:16 JAVA오픈소스/Spring

트렌젝션 사용자 커밋.
참고사항으로 @Transactional 어노테이션이 클레스에나 해당 메소드에 정의되어 있으면 에러남. 어짜고 저짜고 rollback-only

트랜젝션 메니져가 여러개면 마지막에 선언한 트렌젝션 부터 닫아야함 예) 시작 [a b]  commit이나 rollback [b a]

posted by 천상의날개
2015. 11. 17. 11:03 JAVA오픈소스/Spring

@ReqeustParam HashMap<String,Object> params    -- 헤쉬맵에 request 파라메터들을 키 벨류로 분류해서 자동으로 담아줌 (단일 값만 저장가능 리스트로 오는것은 첫번제 값만 담김)

@ReqeustParam MultiValueMap<String, String> multiParams    -- 헤쉬맵에 request 파라메터들을 키 벨류로 분류해서 자동으로 담아줌 (리스트를 담을수 있음)

@ModelAttribute HashMap<String,Object> params -- requestParam어노테이션과 달리 jsp로 포워드했을때 reqeust로 받은 값을 그대로 넘김

@SessionAttributes HashMap<String,Object> params -- ModelAttribute 어노테이션과 같지만 해당값을 세션에도 넣어줌.

posted by 천상의날개