问题:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-10-14 16:41:27.546 ERROR 42324 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userMapper in com.example.demo.service.impl.UserServiceImpl required a bean of type 'com.example.demo.dao.UserMapper' that could not be found.
Action:
Consider defining a bean of type 'com.example.demo.dao.UserMapper' in your configuration.
解决办法是 在dao层的UserMapper上加上@Mapper
package com.example.demo.dao;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* Created by fucheng on 2018/4/29.
*/
@Mapper //声明是一个Mapper,与springbootApplication中的@MapperScan二选一写上即可
@Repository
public interface UserMapper {
User selectUserByName(String name);
}