1. 程式人生 > >SpringJunit測試類 BaseTest(轉)

SpringJunit測試類 BaseTest(轉)

需要 java代碼 ext text with manage XML test 記錄日誌

Java代碼 技術分享圖片
  1. /**
  2. *
  3. *
  4. * @author Jerval
  5. * @date 2011-2-17
  6. */
  7. @RunWith(SpringJUnit4ClassRunner.class)
  8. @ContextConfiguration(locations = { "classpath:applicationContext.xml"})
  9. //@ContextConfiguration(locations = { "classpath:applicationContext.xml","classpath:spring-context/StorageApplicationContext.xml"})
  10. //@TransactionConfiguration(transactionManager = "txManager", defaultRollback = true)
  11. //@Transactional
  12. public class BaseTest {
  13. //如果需要留下數據在數據庫中,請單獨註釋掉//@Transactional
  14. //需要記錄日誌時候直接從子類中使用
  15. protected Logger logger = Logger.getLogger(BaseTest.class);
  16. }

SpringJunit測試類 BaseTest(轉)