강의

멘토링

커뮤니티

Inflearn Community Q&A

inpyo's profile image
inpyo

asked

Practical web development using Java Spring Boot

E02 lombok installation + Mybatis configuration + simple bulletin board API implementation

강사님 2강의 spring MYbatis를 설정하는 곳에서 질문이 있습니다

Written on

·

506

0

 

 

제가 depecdency를 따로 추가해서 mybatis를 넣었는데도  import를 할 수가 없습니다. 혹시 이유가 있을까요??

밑은 pom.xml에 넣은dependency 입니다 <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->

<dependency>

    <groupId>org.mybatis</groupId>

    <artifactId>mybatis</artifactId>

    <version>3.5.7</version>

</dependency>

<!-- MyBatis-Spring -->

  <dependency>

    <groupId>org.mybatis</groupId>

    <artifactId>mybatis-spring</artifactId>

    <version>1.3.0</version>

</dependency>

spring-boot

Answer 2

1

KIP님의 프로필 이미지
KIP
Questioner

스스로 해결됐습니다 감사합니다

songjava님의 프로필 이미지
songjava
Instructor

질문올라온걸 보다가  이제야 확인했네요.

답변을 바로못드려서 죄송합니다.

해결을 하셨다니 다행입니다.!

1

KIP님의 프로필 이미지
KIP
Questioner

일단 Board.xml 쪽에 context.xml을 생성해

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">

    <property name="dataSource" ref="dataSource"></property>

</bean>을 만드니 해결된거 같습니다. 

또 문제가 발생하였는데

factory.setMapperLocations(applicationContext.getResource("classpath:mybatis/sql/*.xml"));

에 setMapperLocations가

"The method setMapperLocations(Resource[]) in the type SqlSessionFactoryBean is not applicable for the arguments (Resource)" 라고 뜨는데 혹시 해결할 방법이 있을까요?

 

inpyo's profile image
inpyo

asked

Ask a question