Vladimir Alarcon
unread,Nov 28, 2020, 1:49:01 PM11/28/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mybati...@googlegroups.com
Hi,
Is it possible to place the MyBatis Main Config file
("mybatis-config.xml") file inside src/main/resources ?
I have a Spring Boot project. I'm using MyBatis XML mappers and they
are located under src/main/resources. Good.
However, the main MyBatis XML config file needs to be placed under
src/main/webapp; if I place it under src/main/resources MyBatis does
not find it. This has also the undesired side effect that it becomes
available as a web resource. For example, this shouldn't work but it
does:
$ wget localhost:8080/mybatis-config.xml
This is how I configured it:
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="mybatis-config.xml" />
<property name="objectFactory" ref="springBeanObjectFactory" />
</bean>
I'm using this configuration to set the "objectFactory" and read VOs
as Spring Beans.
Do you know any way to place it unser src/main/resources? A solution
using Java annotations is also welcome, but I haven't been able to
make it work.
Thank you,
Vlad