gpt4 book ai didi

java - java:软件包org.springframework.dao和org.springframework.jdbc.core不存在

转载 作者:行者123 更新时间:2023-12-01 19:34:14 28 4
gpt4 key购买 nike

刚开始处理Maven和Spring。当我尝试创建DAO和ResultSet然后运行应用程序时,抛出errors:

Error:(4, 31) java: package org.springframework.dao does not exist
Error:(5, 37) java: package org.springframework.jdbc.core does not exist
Error:(5, 43) java: package org.springframework.context.support does not exist


你能建议出什么问题吗?不是这样配置的依赖项或其他东西吗?

我的pom.xml由

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>


DAO类和应用程序附在此处 12

最佳答案

如果您不必开发老式的Spring项目,则可以尝试使用spring-boot,它使配置更加容易。您可以在此处创建一个有效的项目模板:

https://start.spring.io/

关于java - java:软件包org.springframework.dao和org.springframework.jdbc.core不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59235688/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com