라벨이 Mybatis인 게시물 표시

[SpringBoot] Mybatis 다중 Database Setting

스프링 부트에서 다중으로 Database셋팅하는 법입니다. Mybatis기준 Mapper를 따로 사용하지 않고 SqlSession을 사용하는 법입니다. 이틀간 고생했네요... 먼저 Config파일 입니다. 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 //firstDatabase Setting    import  javax.sql.DataSource;   import  org.apache.ibatis.session.SqlSessionFactory; import  org.mybatis.spring.SqlSessionFactoryBean; import  org.mybatis.spring.SqlSessionTemplate; import  org.springframework.beans.factory.annotation.Qualifier; import  org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import  org.springframework.boot.context.properties.ConfigurationProperties; import  org.springframework.context.annotation.Bean; import  org.springframework.con...