Skip to content

sqlSessionFactory is needed when using mybatis:scan #4

@sinbadblue

Description

@sinbadblue

per the document at: http://mybatis.github.io/spring/mappers.html#scan

"Notice that there is no need to specify a SqlSessionFactory or SqlSessionTemplate because the mybatis:scan/ will create MapperFactoryBeans that can be autowired."

however, I ran into the following exception:

"Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required"

After adding one bean definition of org.mybatis.spring.SqlSessionFactoryBean, the problem is solved.

Is the document wrong? or it only works for certain version?

I am using following version of mybatis and mybatis-spring:

org.mybatis mybatis 3.2.0 org.mybatis mybatis-spring 1.2.0

any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions