org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couponController': Unsatisfied dependency expressed through field 'couponService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'couponService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.microstudy.coupon.dao.CouponDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
解决办法: 添加MapperScan
添加MapperScan后遇到报错
java.lang.TypeNotPresentException: Type [unknown] not present
解决办法:
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.4.0</version>
</dependency>
改为:
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>