How to config mybatis datasource?not a simple jdbc
See original GitHub issuein a spring project,I usually config like this:
<bean id="rowanTemplateSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="XXXDataSource" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="rowanTemplateSqlSessionFactory" />
</bean>
``
but when I use mybatis-spring-boot,how to config XXXDataSource?I tried lots of times,but still failed.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
MyBatis 3 | Configuration
The MyBatis configuration contains settings and properties that have a ... Some drivers require specifying the column JDBC type but others ...
Read more >MYBATIS - Configuration XML - Tutorialspoint
This chapter discusses how to configure MyBatis using XML file. ... If we use the transaction manager of type JDBC, the application is...
Read more >Apache Tomcat 8 (8.5.84) - JNDI Datasource How-To
Before you proceed, don't forget to copy the JDBC Driver's jar into $CATALINA_HOME/lib . 1. MySQL configuration. Ensure that you follow these ...
Read more >Use MyBatis to use the JDBC driver for Tablestore
This topic describes how to access Tablestore by using MyBatis to use the Java Database Connectivity (JDBC) driver for Tablestore.
Read more >MyBatis with Spring - Baeldung
In our examples, we'll use the H2 embedded database to simplify the setup and EmbeddedDatabaseBuilder class from the spring-jdbc module for ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Add this to your dependencies:
Then, put this in your application.yml:
Then you can autowire the datasource inside any spring-managed bean, for instance in a configuration:
Then you just need to keep writing your Mapper XMLs and Interfaces in the same way you’ve been doing it.
@CharlesMaster any news about this?