我正在做项目的Spring启动...但是得到了这个错误,而运行应用程序。这可能是H2数据库错误。但是要解决这个错误localhost应该运行,但程序在部署前终止...所以我不能看到什么是实际问题。
错误:org.springframework.beans.factory.BeanCreationException:创建名称为'project TaskRepository'的bean时出错com.agileintelligence.projectdashboard.repository.在JpaRepositories注册器上声明的@EnableJpaRepositories中定义的ProjectTaskRepository。EnableJpaRepositoriesConfiguration:在设置bean属性'mappingContext'时无法解析对bean'jpaMappingContext'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名称为'jpaMappingContext'的bean时出错:调用init方法失败;嵌套异常是org.hibernate.注释异常:未为实体指定标识符:com.agileintelligence.projectdashboard.domain.project任务
表类
package com.agileintelligence.projectdashboard.domain;
import org.springframework.data.annotation.Id;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.validation.constraints.NotBlank;
@Entity
public class projectTask {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@NotBlank(message = "Summary cannot be empty")
private String summary;
private String acceptanceCriteria;
private String status;
public projectTask() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getAcceptanceCriteria() {
return acceptanceCriteria;
}
public void setAcceptanceCriteria(String acceptanceCriteria) {
this.acceptanceCriteria = acceptanceCriteria;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
控制器
package com.agileintelligence.projectdashboard.web;
import com.agileintelligence.projectdashboard.domain.projectTask;
import com.agileintelligence.projectdashboard.service.ProjectTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/board")
@CrossOrigin
public class ProjectTaskController {
@Autowired
private ProjectTaskService service;
@PostMapping("")
public ResponseEntity<?> addProjectTaskToBoard(@RequestBody projectTask projectTask){
com.agileintelligence.projectdashboard.domain.projectTask newPT = service.saveOrUpdateProjectTask(projectTask);
return new ResponseEntity<>(newPT, HttpStatus.CREATED);
}
}
服务等级
package com.agileintelligence.projectdashboard.service;
import com.agileintelligence.projectdashboard.domain.projectTask;
import com.agileintelligence.projectdashboard.repository.ProjectTaskRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ProjectTaskService {
@Autowired
private ProjectTaskRepository projectTaskRepository;
public projectTask saveOrUpdateProjectTask(projectTask projectTask){
//In case if status is not set,automatically push it to TO_DO
if(projectTask.getStatus()==null||projectTask.getStatus().equals("")){
projectTask.setStatus("TO_DO");
}
return projectTaskRepository.save(projectTask);
}
}
存储库
package com.agileintelligence.projectdashboard.repository;
import com.agileintelligence.projectdashboard.domain.projectTask;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ProjectTaskRepository extends CrudRepository<projectTask,Long> {
}
您使用的Id导入错误。
import org.springframework.data.annotation.Id;
将上面的替换为下面的持久性包。
import javax.persistence.Id
好处:用ProjectTask(大写P)重命名实体,以防止将来出现奇怪的问题。
我得到以下错误消息,而运行我的项目 组织。springframework。豆。工厂UnsatisfiedPendencyException:创建名为“TipoeStatDoCivilController”的bean时出错:通过字段“TipoeStatDoCivilService”表示的未满足的依赖关系;嵌套的异常是org。springframework。豆。工厂UnsatisfiedPendenc
我正在使用带有Boot的Spring Batch并使用XML配置来配置批处理作业。但是批处理作业是使用Tivoli调度的。同样,我希望通过使用批处理启动器进行配置来在本地运行。 我们怎样才能满足依赖性? 当我配置JobLauncher时 Database aseConfig.java XML配置:
为什么自动加载依赖项的注入失败。 严重:上下文初始化失败。springframework。豆。工厂BeanCreationException:创建名为“homeController”的bean时出错:自动连线依赖项的注入失败;嵌套的异常是org。springframework。豆。工厂BeanCreationException:无法自动关联字段:com。快速启动。通用域名格式。springmvc。
我有一个Spring启动应用程序。我用@Component注释了项目的一个类。现在在我的主类中,当我试图获取该类的bean时,我得到一个异常,它无法找到该bean。 注释为组件的类如下
2020-09-23T15:28:00.3483912Zjava.lang.IllegalStateExcture:未能加载Application ationContext 2020-09-23T15:28:00.3489821Z引起的原因:org.springframework.beans.factory.不满意依赖异常:创建在文件[/home/run/work/comation-service
我使用Maven+Spring Framework 当我从IDEA在tomcat服务器上部署本地项目时,我得到一个错误: org.springframework.beans.factory.BeanCreationException:创建类路径资源[com/qoobico/remindme/server/config/databaseConfig.class]中定义的名为“Entity Manag