JAX-RS의 구성
Posted at 2009/06/01 13:34// Posted in 나만의 작업'나만의 작업' 카테고리의 다른 글
| Jersey의 Exception Handling (0) | 2009/06/05 |
|---|---|
| Jersey의 Return Type (0) | 2009/06/04 |
| Jersey의 MessageBodyReader/Writer (0) | 2009/06/03 |
| JAX-RS @Produces와 @Consumes (2) | 2009/06/02 |
| JAX-RS의 구성 (0) | 2009/06/01 |
| What is Jersey? (0) | 2009/06/01 |
| What is JAX-RS? (0) | 2009/05/29 |
| What is REST? (2) | 2009/05/27 |
| Thinkfree Office Live 한국어 서비스 시작 (2) | 2009/04/01 |
[Spring] @Autowired의 Before/After
Posted at 2009/04/29 15:35// Posted in 나만의 작업/SpringapplicationContext.xml에서 설정
<bean id="empDao" class="EmpDao" /> <bean id="empManager" class="EmpManager"> <property name="empDao" ref="empDao" /> </bean>
public class EmpManager { private EmpDao empDao; public EmpDao getEmpDao() { return empDao; } public void setEmpDao(EmpDao empDao) { this.empDao = empDao; } ... }
After
<context:annotation-config /> <!-- 요거 꼭 빼먹지 말것 --> <bean id="empManager" class="autowiredexample.EmpManager" /> <bean id="empDao" class="autowiredexample.EmpDao" />
import org.springframework.beans.factory.annotation.Autowired; public class EmpManager { @Autowired private EmpDao empDao; }
'나만의 작업 > Spring' 카테고리의 다른 글
| [Spring] @Autowired의 Before/After (2) | 2009/04/29 |
|---|---|
| [Spring] 스프링에서 VelocityTools 환경설정 (2) | 2008/03/20 |
| [Spring] 스프링 MVC를 이용한 웹 요청 처리 (4) | 2008/03/13 |
| [Spring] Bean과 BeanFactory의 후처리 (8) | 2008/02/12 |
| [Spring] 자동 묶기(Autowire) (2) | 2008/02/12 |
| [Spring] 세터 주입(Setter Injection)의 대안 (5) | 2008/02/05 |
| [Spring] 빈 묶기(Bean wiring) (2) | 2008/02/05 |
| [Spring] 스프링 컨테이너의 두 종류 (0) | 2008/02/05 |
| [Spring] Spring 환경설정 (4) | 2008/01/28 |
[iBATIS] 8. Annotation 기반으로 JUnit4를 이용한 Spring TDD ~ 9. Reference
Posted at 2008/09/03 10:13// Posted in 나만의 작업/iBatis8. Annotation 기반으로 JUnit4를 이용한 Spring TDD
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback=true)
@RunWith : 테스트를 실행할 org.junit.runner.Runner 구현 클래스를 지정할 수 있다.
스프링은 스프링 컨텍스트 설정 및 DI, 트랜잭션 처리 등을 지원해주는 Runner 구현 클래스를 제공하고 있다.
Junit 4 기반의 테스트에서 스프링 컨텍스트에 설정된 빈 객체를 사용하고 싶다면 SpringJunit4ClassRunner 클래스를 @RunWith 어노테이션 값으로 설정하면 된다.
@ContextConfiguration : 스프링 컨텍스트를 생성할 때 사용될 설정 파일의 경로
@Autowired, @Resource : 테스트 코드에서 필요로 하는 스프링 빈 객체 설정
- 트랜잭션 처리를 위한 설정
@TransactionConfiguration : 테스트 클래스에 적용되며, 트랜잭션 관리자와 기본 롤백 규칙을 설정한다.
@Rollback : 테스트 메소드에 적용되며, 메소드 단위로 롤백 규칙을 설정한다.
@NotTransactional : 트랜잭션을 적용하지 않을 메소드에 적용한다.
@Transactional : 테스트 클래스에 적용. 이 어노테이션을 적용함으로써 각 테스트 메소드는 트랜잭션 범위 내에서 실행된다.
만약 테스트 메소드에서 명시적으로 롤백 여부를 설정하고 싶다면 @Rollback 어노테이션을 사용하면 된다.
@Rollback(false)
테스트 메소드에 대한 트랜잭션이 시작되기 전에 어떤 초기화 작업을 해주어야 한다며, @BeforeTransaction 어노테이션이 적용된 메소드를 작성하면 된다.
반대로 트랜잭션이 종료된 이후에 정리 작업을 해주어야 할 경우에는 @AfterTransaction 어노테이션이 적용된 메소드를 작성하면 된다.
@RunWith (SpringJUnit4ClassRunner. class )
@ContextConfiguration (locations = { "classpath:/com/mydomain/data/beans.xml" })
@TransactionConfiguration (transactionManager = "transactionManager" ,defaultRollback= true )
@Transactional
public class iBatisDaoTest {
@Autowired
private ImageService imageService ;
private int id ;
@Test
public void testInsertImage() {}
}
9. Reference
SQL Maps2.0 개발자가이드 ( 한글판 )
http://ibatis.apache.org/docs/java/pdf/iBATIS-SqlMaps-2_ko.pdf
SQL Maps2.0 tutorial( 한글판 )
http://ibatis.apache.org/docs/java/pdf/iBATIS-SqlMaps-2-Tutorial_ko.pdf
iBATIS 에서 생성되는 SQL 문을 보기 위한 log4j 셋팅
http://openframework.or.kr/JSPWiki/Wiki.jsp?page=IbatisLog4jSettingToShowSQL
Sql2ibatis
http://openframework.or.kr/JSPWiki/Wiki.jsp?page=Sql2ibatis
DDL2iBatis
http://openframework.or.kr/JSPWiki/attach/Hibernate/DDL2iBatis-exe.zip
Spring 2.5, Eclipse and JUnit 4.4
http://dertompson.com/index.php/2007/12/12/spring-25-eclipse-and-junit-44/
iBATIS 인 액션: 쉽고 강력한 SQL 매핑 프레임워크 아이바티스
- 클린턴 비긴.브랜든 구딘.래리 메도스 지음 | 이동국.손권남 번역, 위키북스
스프링 2.5 프로그래밍
- 최범균 , 가메출판사
'나만의 작업 > iBatis' 카테고리의 다른 글
| [iBatis] iBatis에서 Log4j를 이용하여 쿼리를 로그로 남기려면? (4) | 2009/01/20 |
|---|---|
| [iBatis] 자동 생성 Key (2) | 2009/01/18 |
| [iBatis] 자바빈즈와 Map 타입의 결과 (0) | 2009/01/18 |
| [iBATIS] 8. Annotation 기반으로 JUnit4를 이용한 Spring TDD ~ 9. Reference (4) | 2008/09/03 |
| [iBATIS] 7. iBATIS + Spring + transaction (0) | 2008/09/02 |
| [iBATIS] 6. iBATIS + Spring (0) | 2008/09/01 |
| [iBATIS] 5. Transaction (2) | 2008/09/01 |
| [iBATIS] 4. How to (2) | 2008/08/29 |
| [iBATIS] 1.Overview ~ 3. Introduce iBATIS (4) | 2008/08/28 |


