在用xml文件配置之后感觉过于麻烦, 然后研究了一下纯注解的方式来实现, 然后遇到了一些问题, 下面将问题列出(由于自己是小白, 所述术语不当, 还望谅解指正):
问题一:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accountService': Unsatisfied dependency expressed through field 'accountMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountMapper' defined in file [E:\Code\SpringCode\SSM\target\classes\com\rwg\mapper\AccountMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
之后发现是config配置文件没有写mybatis核心工厂
原config的配置文件:
@Configuration
@ComponentScan(basePackages = {"com.rwg"})
@MapperScan("com.rwg.mapper")
@PropertySource("classpath: