mybatis + spring boot + mapper invocation on @PostConstruct

60 views
Skip to first unread message

Federico Capuzzimati

unread,
Oct 26, 2021, 8:02:41 AM10/26/21
to mybatis-user
Hi Everyone,
I would need to call a mybatis mapper, injected in a @Service spring class, in the @PostConstruct method, in order to setup a number of fields of the @Service class.
However, it seems that mybatis mappers aren't initialized yet: I get exceptions like "no xml fragments loaded", "no method registered for the mapper" and such like.

There's a way to invoke mybatis mappers in the @PostConstruct methods?

Thank, 

Biao Huang

unread,
Oct 27, 2021, 11:16:43 PM10/27/21
to mybati...@googlegroups.com
You can try ApplicationRunner or CommandLineRunner to accomplish it if possible.

Federico Capuzzimati <federico.c...@gmail.com> 于2021年10月26日周二 下午8:02写道:
--
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 mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/dff5b7ba-0a6f-4b77-8970-3e31bd9a7153n%40googlegroups.com.


--
=====================================
QQ:     26664141
Skype: biao.mac
EMail:  biao...@gmail.com

Tel: Home:  495312217000
Tel: Mobile: 4917620793369
Reply all
Reply to author
Forward
0 new messages