본문 바로가기
IT/Spring

[Spring] - 스프링 부트(Spring boot)에서 Oracle, Mybatis 설정 및 사용(연동) 하는 방법

by 차이나는 개발자 2021. 11. 28.
728x90
반응형

#스프링 부트(Spring boot)에서 Oracle, Mybatis 설정 및 사용(연동) 하는 방법

 

 

#pom.xml 의존성 추가

-mybatis-spring-boot-starter, ojdbc8 라이브러리를 추가해줍니다.

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.1.4</version>
</dependency>

<dependency>
    <groupId>com.oracle.database.jdbc</groupId>
    <artifactId>ojdbc8</artifactId>
    <scope>runtime</scope>
</dependency>

 

 

#application.properties 파일에 설정 추가

-Oracle 접속 정보와 mapper 파일 경로를 설정해줍니다.

#Oracle 설정
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/xe
spring.datasource.username=id
spring.datasource.password=password

#mapper 경로 설정
mybatis.mapper-locations=classpath:mappers/*.xml

 

 

 

728x90
반응형

댓글