Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

spring - Spring框架导入失败(Spring framework import failed)

I am starting on Spring and learning its foundations.

(我从Spring开始并学习它的基础。)

I created a project in intellij

(我在intellij创建了一个项目)

It was giving an error stating that web cannot be imported.

(出现错误,指出无法导入Web。)

在此处输入图片说明

so i guessed it must have been .

(所以我猜一定是这样。)

my gradle build file which does not have web

(没有网络的我的gradle构建文件)

I tried to import in manually via the build.gradle file as below but it throws me an error saying it cannot be found.

(我尝试通过build.gradle文件手动导入,如下所示,但它抛出一个错误,提示找不到该错误。)

WHat am i doing wrong and how can i resolve this?

(我做错什么了,我该如何解决?)

plugins {
    id 'org.springframework.boot' version '2.2.2.BUILD-SNAPSHOT'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'io.codementor.gtommee'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
    maven { url 'https://repo.spring.io/snapshot' }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

any help?

(有什么帮助吗?)

  ask by adr translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are missing the spring-boot-starter-web dependency in your build.gradle file.

(您在build.gradle文件中缺少spring-boot-starter-web依赖项。)

To get started, have a look at https://start.spring.io/

(首先,请查看https://start.spring.io/)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...