小编Kub*_*dry的帖子

字段jdbcTemplate需要找不到类型为'org.springframework.jdbc.core.JdbcTemplate'的bean

我制作了一个简单的应用程序以连接到MySQL数据库,但出现此错误:

org.springframework.jdbc.core.JdbcTemplate

在我的配置中(com.kubamadry.dao.MySqlStudentDao)

*****************************
APPLICATION FAILED TO START
*****************************

Description:

Field jdbcTemplate in com.kubamadry.dao.MySqlStudentDao required a bean of type 'org.springframework.jdbc.core.JdbcTemplate' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.jdbc.core.JdbcTemplate' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:49838', transport: 'socket'

Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)

项目结构:

图片

班级

主要

package com.kubamadry;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Main {
    public static void main(String args[]) {
        SpringApplication.run(Main.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

学生

package …
Run Code Online (Sandbox Code Playgroud)

java spring spring-jdbc spring-bean spring-boot

5
推荐指数
1
解决办法
6455
查看次数

标签 统计

java ×1

spring ×1

spring-bean ×1

spring-boot ×1

spring-jdbc ×1