springboot报错

shpringboot运行之后访问本地数据,报mapper语句和xml文件没绑定,检查了xml文件id的正确性,也没写错,运行之后也有mapper文件,contoller层的goods方法点进去进入的是service接口,而不是进入impl,反而从impl可以进入到controller层,有遇到过这样问题的吗
报错如下

img


代码如下
控制层

package com.duing.controller;

import com.duing.model.Goods;
import com.duing.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//@Controller
@RestController
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @GetMapping("/")
    public List list(){
//        return "list";
        return goodsService.getGoods();
    }
}

mapper


```java
package com.duing.mapper;

import com.duing.model.Goods;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface GoodsMapper {
    List getGoods();
}


model层


package com.duing.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Goods {
    private long id;
    private String goods_id;
    private String goods_name;
    private String goods_type;
    private double price;
    private String img_path;

}

service层

package com.duing.service.impl;

import com.duing.mapper.GoodsMapper;
import com.duing.model.Goods;
import com.duing.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List getGoods() {
        return goodsMapper.getGoods();
    }
}


package com.duing.service;

import com.duing.model.Goods;

import java.util.List;

public interface GoodsService {
    List getGoods();
}

xml文件


mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.duing.mapper.GoodsMapper">
    <select id="getGoods"  resultType="com.duing.model.Goods">
        select id,good_id,goods_name,goods_type,price,img_path
        from goods
    select>
mapper>


application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/shop
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root


mybatis.mapper-locations=classpath*:/mapper/*.xml
mybatis.type-aliases-package=com.dui

pom文件


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.7.3version>
        <relativePath/> 
    parent>
    <groupId>com.duinggroupId>
    <artifactId>spring-boot-duing-shop-seckillartifactId>
    <version>0.0.1-SNAPSHOTversion>
    <name>spring-boot-duing-shop-seckillname>
    <description>spring-boot-duing-shop-seckilldescription>
    <properties>
        <java.version>1.8java.version>
    properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-thymeleafartifactId>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>
        <dependency>
            <groupId>org.mybatis.spring.bootgroupId>
            <artifactId>mybatis-spring-boot-starterartifactId>
            <version>2.2.2version>
        dependency>

        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-devtoolsartifactId>
            <scope>runtimescope>
            <optional>trueoptional>
        dependency>
        <dependency>
            <groupId>mysqlgroupId>
            <artifactId>mysql-connector-javaartifactId>
            <scope>runtimescope>
        dependency>
        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
            <optional>trueoptional>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>
    dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombokgroupId>
                            <artifactId>lombokartifactId>
                        exclude>
                    excludes>
                configuration>
            plugin>
        plugins>
    build>

project>


```

xml文件语句查询id跟数据库的不一致

img


包名写错了,com.duing.mapper

配置文件配置不完整,domain