我跟踪了下面的文章并设置了项目
https://www.callicoder.com/spring-boot-rest-api-tutorial-with-mysql-jpa-hibernate/
我附上POM以供参考。当我运行该项目时,我得到:
2019-12-11 14:53:12.373警告10004---[restartedMain]ConfigServletWebServerApplicationContext:上下文初始化过程中遇到异常-取消刷新尝试:org.springframework.beans.factory.unsatisfiedDependencyException:创建名为“Note Controller”的bean时出错:通过字段“Note Repository”表示未满足的依赖关系;嵌套异常是org.springframework.beans.factory.nosuchBeanDefinitionException:没有类型为'com.example.easyNotes.repository.noteRepository'的合格bean可用:至少需要1个符合autowire候选的bean。依赖项注释:{@org.springframework.beans.factory.annotation.autowired(required=true)}2019-12-11 14:53:12.389信息10004---[restartedMain]o.apache.catalina.core.standardService:停止服务[Tomcat]2019-12-11 14:53:12.389信息10004---[restartedMain]条件评估报告日志监听器:
启动ApplicationContext时出错。若要显示条件报告,请在启用“调试”的情况下重新运行应用程序。2019-12-11 14:53:12.499错误10004---[restartedMain]O.S.B.D.LoggingFailureAnalysisReporter:
************************应用程序启动失败
说明:
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>easy-notes</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>easy-notes</name>
<description>Rest API for a Simple Note Taking Application</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.1.RELEASE</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>5.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.2.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
NoteRepository接口:
package com.example.easynotes.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.easynotes.model.Note;
import org.springframework.stereotype.Repository;
@Repository
public interface NoteRepository extends JpaRepository<Note,Long> {
}
@repository
注释标记noterepository
类。@enablejparepositories(basePackages={“com.example.easyNotes.repository”})
我试图从Wicket Examples页面运行一个示例“库应用程序”,并且我已经在我的eclipse项目上复制了所有必要的类/HTML文件。 意外得RuntimeException最后原因:org.apache.wicket.attributeModifier.(ljava/lang/string;zlog/apache/wicket/model/imodel;)V WicketMessage:无
我无法在Springboot java上运行代码示例。有人有解决方案吗?我能做什么我不知道我刚刚开始。。。 09:57:28.372[main]调试组织。springframework。靴子开发工具。设置。DevToolsSettings-包括重启模式:[]09:57:28.374[main]调试组织。springframework。靴子开发工具。设置。devtools设置-排除重启模式:[/sp
我得到低于错误 错误:
我在我的系统上安装了AlchemyApi,也获得了Api密钥。但是当我运行readme.txt文件中提到的示例时,我得到以下错误:- alchemyapi_java-0.8/testdir$java-jar../dist/alchemyapi-entity-test.jar
我正在VMware中Ubuntu12.04的单节点环境中运行hadoop wordcount示例。我运行的示例是这样的:-- 当我运行wordcount程序时,我得到以下错误:--
我试图在SpringMVC中运行SpringBoot应用程序,在SpringMVCPOM中添加SpringBoot应用程序依赖项,并扫描SpringBoot包,但我面临以下问题