Spring Boot starter vs components

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Spring Boot starter vs components

Jason Bennett
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

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Spring Boot starter vs components

Kazuki Shimizu
Hi Jason,
Could you provide a reproduce projects(work fine and not work fine) on GitHub ?

On Friday, April 21, 2017 at 7:49:50 AM UTC+9, Jason Bennett wrote:
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

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Spring Boot starter vs components

Jason Bennett-2
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



On Thu, Apr 20, 2017 at 6:11 PM, Kazuki Shimizu <[hidden email]> wrote:
Hi Jason,
Could you provide a reproduce projects(work fine and not work fine) on GitHub ?


On Friday, April 21, 2017 at 7:49:50 AM UTC+9, Jason Bennett wrote:
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

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.



--
Jason Bennett, [hidden email]
E pur si muove!

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Spring Boot starter vs components

Kazuki Shimizu
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.

I think It is working as design ! This behavior is standard design on creating a spring boot auto-configure class.

For reference...

* https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java#L55
* https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfiguration.java#L46

Thanks.


On Saturday, April 22, 2017 at 3:53:56 AM UTC+9, Jason Bennett wrote:
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



On Thu, Apr 20, 2017 at 6:11 PM, Kazuki Shimizu <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="FMggeC53AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">kazuk...@...> wrote:
Hi Jason,
Could you provide a reproduce projects(work fine and not work fine) on GitHub ?


On Friday, April 21, 2017 at 7:49:50 AM UTC+9, Jason Bennett wrote:
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

--
You received this message because you are subscribed to a topic in the Google Groups "mybatis-user" group.
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/mybatis-user/3DqBQR_DHvU/unsubscribe" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/topic/mybatis-user/3DqBQR_DHvU/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/mybatis-user/3DqBQR_DHvU/unsubscribe&#39;;return true;">https://groups.google.com/d/topic/mybatis-user/3DqBQR_DHvU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FMggeC53AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Jason Bennett, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FMggeC53AgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jas...@...
E pur si muove!

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...