티스토리 뷰

package com.psj.login.dbConnectionTest;

import lombok.extern.log4j.Log4j2;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.sql.Connection;


/**
 * packageName    : com.psj.login.dbConnectionTest
 * fileName       : DB_Conection_Test
 * author         : ipeac
 * date           : 2022-03-26
 * description    :
 * ===========================================================
 * DATE              AUTHOR             NOTE
 * -----------------------------------------------------------
 * 2022-03-26        ipeac       최초 생성
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@Log4j2
public class DBConectionTest {

      @Autowired
      private SqlSessionFactory sqlSessionFactory;

      @Test
      public void connection_test() {
            try {
                  Connection con = sqlSessionFactory.openSession().getConnection();
                  log.debug("DB 연결성공");
            } catch (Exception e) {

                  e.printStackTrace();
            }
      }

}

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
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
글 보관함