Spring Boot starter vs components

13 views
Skip to first unread message

Jason Bennett

unread,
Apr 20, 2017, 6:49:50 PM4/20/17
to mybatis-user
We're trying to minimize our use of starter POMs with Spring Boot, in order to minimize extraneous dependencies in our app. Mybatis, however, appears to behave differently when its starter jar is included. When I use the starter jar, everything in my app works fine. When, however, I include the 3 parts (mybatis, mybatis-spring and mybatis-spring-boot-autoconfigure), the annotation scanning does not appear to run, and no mappers are instantiated. I cannot, however, find any code anywhere that would cause this behavior. Am I missing something obvious?

jason

Kazuki Shimizu

unread,
Apr 20, 2017, 9:11:18 PM4/20/17
to mybatis-user
Hi Jason,
Could you provide a reproduce projects(work fine and not work fine) on GitHub ?

Jason Bennett

unread,
Apr 21, 2017, 2:53:56 PM4/21/17
to mybati...@googlegroups.com
In the process of producing that project, I managed to pull out the problem.

In trying to distill my dependencies from the starter jars, I had neglected to add the tomcat-jdbc library to my list of dependencies. From looking at the debug trace, if Mybatis cannot find a datasource, it (more or less) terminates its initialization process, without an error. Later, when trying to find beans to inject into my service, Spring throws an error, because Mybatis never initialized the mapper files.

I'm not sure if this is something Mybatis can better message, but I found it a little subtle to discover.

jason



--
You received this message because you are subscribed to a topic in the Google Groups "mybatis-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mybatis-user/3DqBQR_DHvU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mybatis-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jason Bennett, jas...@acm.org
E pur si muove!

Kazuki Shimizu

unread,
Apr 21, 2017, 7:34:13 PM4/21/17
to mybatis-user, jas...@acm.org
Hi Jason,

To enable the MybatisAutoConfiguration, you need to define a bean that implements the DataSource interface like.
 
>  if Mybatis cannot find a datasource, it (more or less) terminates its initialization process, without an error.

To unsubscribe from this group and all its topics, send an email to mybatis-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages