gpt4 book ai didi

java - 新问题 : Exception encountered during context initiali. - 取消。引用。尝试。 : org. springframework.beans.factory.UnsatisfiedDependencyException

转载 作者:行者123 更新时间:2023-12-01 16:54:22 25 4
gpt4 key购买 nike

这是我在这里发表的第一篇文章。我是初学者。我正在开发一个 Spring Boot 应用程序。尝试了很多解决方案后,问题都没有得到解决。请帮忙(如果缺少任何代码片段,我会发送它。):

控制台:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-05-05 19:02:21.266 ERROR 3484 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'doctorApiController': Unsatisfied dependency expressed through field 'doctorService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'doctorServiceImpl': Unsatisfied dependency expressed through field 'doctorRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'doctorRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class io.swagger.model.Doctor
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at io.swagger.Swagger2SpringBoot.main(Swagger2SpringBoot.java:37) [classes/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'doctorServiceImpl': Unsatisfied dependency expressed through field 'doctorRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'doctorRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class io.swagger.model.Doctor
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'doctorRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class io.swagger.model.Doctor
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1710) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
... 30 common frames omitted
Caused by: java.lang.IllegalArgumentException: Not a managed type: class io.swagger.model.Doctor
at org.hibernate.metamodel.internal.MetamodelImpl.managedType(MetamodelImpl.java:472) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:73) ~[spring-data-jpa-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:66) ~[spring-data-jpa-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:181) ~[spring-data-jpa-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:119) ~[spring-data-jpa-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:102) ~[spring-data-jpa-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:298) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$3(RepositoryFactoryBeanSupport.java:287) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:141) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.data.util.Lazy.get(Lazy.java:63) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:290) ~[spring-data-commons-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:102) ~[spring-data-jpa-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1769) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
... 40 common frames omitted

DoctorApiController:

@Controller
public class DoctorApiController implements DoctorApi {
@Autowired
private doctorService doctorService;

private static final Logger log = LoggerFactory.getLogger(DoctorApiController.class);

private final ObjectMapper objectMapper;

private final HttpServletRequest request;

@org.springframework.beans.factory.annotation.Autowired
public DoctorApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}

public ResponseEntity<Doctor> addDooctor(@ApiParam(value = "Created doctor object" ,required=true ) @Valid @RequestBody Doctor body) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {

io.swagger.Swagger2SpringBoot.ListD.add(body);
//return new ResponseEntity<Doctor>(body, HttpStatus.OK );
return ResponseEntity.ok(doctorService.addDoctor(body));
}
return new ResponseEntity<Doctor>(HttpStatus.NOT_IMPLEMENTED);

}


public ResponseEntity<Doctor> deleteDoctorById(
@ApiParam(value = "Numeric ID of the user to get.", required = true) @PathVariable("id") Long id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
return ResponseEntity.ok(doctorService.deleteDoctorById(id));

}
return new ResponseEntity<Doctor>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Doctors> findAllDoctors() {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {

Doctors sts = new Doctors2();
sts.setDoctors(doctorService.findAllDoctors());
return ResponseEntity.ok(sts);
}

return new ResponseEntity<Doctors>(HttpStatus.NOT_IMPLEMENTED);
}


public ResponseEntity<List<Doctor>> updateDoctor(@ApiParam(value = "name that need to be updated",required=true) @PathVariable("Doctorname") String Doctorname,@ApiParam(value = "Updated Doctor object" ,required=true ) @Valid @RequestBody Doctor body) {
String accept = request.getHeader("Accept");

if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<List<Doctor>>(io.swagger.Swagger2SpringBoot.ListD, HttpStatus.OK);
}

return new ResponseEntity<List<Doctor>>(HttpStatus.NOT_IMPLEMENTED);
}

}

医生服务:

package io.swagger.service;

import java.util.List;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import io.swagger.model.Doctor;
@Service
public interface doctorService {
public Doctor addDoctor(Doctor doctor);
public Doctor deleteDoctorById(long id);
public List<Doctor> findAllDoctors();
public Doctor updateDoctor(Doctor doctor);
@Cacheable ("doctors")
public Doctor findDoctorById(long id);

}

doctorServiceImpl:

package io.swagger.service;

import java.util.List;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import io.swagger.model.Doctor;


@Service
@Transactional
public class doctorServiceImpl implements doctorService {
@Autowired
private doctorRepository doctorRepository;
@Transactional
public void adddoctor(Doctor doctor){
doctorRepository.saveAndFlush(doctor);
}
@Override
public Doctor addDoctor(Doctor doctor) {
return doctorRepository.save(doctor);
}

@Override
public Doctor deleteDoctorById(long id) {
Optional<Doctor> os = doctorRepository.findById(id);
if(os.isPresent()) doctorRepository.deleteById(id);
return os.get();
}

@Override
public List<Doctor> findAllDoctors() {
return doctorRepository.findAll();
}


@Override
public Doctor findDoctorById(long id) {
Optional<Doctor> os = doctorRepository.findById(id);
if(os.isPresent()) return os.get();
else return null;
}

@Override
public Doctor updateDoctor(Doctor doctor) {
doctorRepository.updateDoctorById(doctor.getId(), doctor.getDoctorname(), doctor.getFirstName(), doctor.getLastName(), doctor.getEmail(), doctor.getPassword(), doctor.getPhone(), doctor.getAvatarUrl(), doctor.getDoctorvotes());
return doctor;


}
}

医生存储库:

 package io.swagger.service;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import io.swagger.model.Doctor;

public interface doctorRepository extends JpaRepository<Doctor,Long> {
@Modifying
@Query("update Doctor s set s.id = ?1, s.doctorname = ?2, s.firstName = ?3, s.lastName = ?4, s.email = ?5, s.password = ?6, s.phone = ?7, s.avatarUrl = ?8, s.doctorvotes = ?9")

void updateDoctorById(Integer id, String doctorname, String firstName, String lastName, String email,
String password, String phone, String avatarUrl, Integer doctorvotes);
}

“model.Doctor”是 -> 医生:

package io.swagger.model;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.Valid;
import javax.validation.constraints.*;

/**
* Doctor
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-19T11:38:27.027Z")


@Table(name = "doctors")
@JsonRootName("Doctor")

public class Doctor {
@JsonProperty("id")
private Integer id = null;

@JsonProperty("Doctorname")
private String Doctorname = null;

@JsonProperty("firstName")
private String firstName = null;

@JsonProperty("lastName")
private String lastName = null;

@JsonProperty("email")
private String email = null;

@JsonProperty("password")
private String password = null;

@JsonProperty("phone")
private String phone = null;

@JsonProperty("avatarUrl")
private String avatarUrl = null;

@JsonProperty("Doctorvotes")
private Integer Doctorvotes = null;

public Doctor id(Integer id) {
this.id = id;
return this;
}

/**
* Get id
* @return id
**/
@ApiModelProperty(value = "")


public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Doctor Doctorname(String Doctorname) {
this.Doctorname = Doctorname;
return this;
}


@ApiModelProperty(value = "")


public String getDoctorname() {
return Doctorname;
}

public void setDoctorname(String Doctorname) {
this.Doctorname = Doctorname;
}

public Doctor firstName(String firstName) {
this.firstName = firstName;
return this;
}

/**
* Get firstName
* @return firstName
**/
@ApiModelProperty(value = "")


public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public Doctor lastName(String lastName) {
this.lastName = lastName;
return this;
}

/**
* Get lastName
* @return lastName
**/
@ApiModelProperty(value = "")


public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public Doctor email(String email) {
this.email = email;
return this;
}

/**
* Get email
* @return email
**/
@ApiModelProperty(value = "")


public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public Doctor password(String password) {
this.password = password;
return this;
}

/**
* Get password
* @return password
**/
@ApiModelProperty(value = "")


public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public Doctor phone(String phone) {
this.phone = phone;
return this;
}

/**
* Get phone
* @return phone
**/
@ApiModelProperty(value = "")


public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

public Doctor avatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
return this;
}

/**
* Get avatarUrl
* @return avatarUrl
**/
@ApiModelProperty(value = "")


public String getAvatarUrl() {
return avatarUrl;
}

public void setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
}

public Doctor Doctorvotes(Integer Doctorvotes) {
this.Doctorvotes = Doctorvotes;
return this;
}

/**
* Doctor Number of votes
* @return Doctorvotes
**/
@ApiModelProperty(value = "Doctor Number of votes")


public Integer getDoctorvotes() {
return Doctorvotes;
}

public void setDoctorvotes(Integer Doctorvotes) {
this.Doctorvotes = Doctorvotes;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Doctor doctor = (Doctor) o;
return Objects.equals(this.id, doctor.id) &&
Objects.equals(this.Doctorname, doctor.Doctorname) &&
Objects.equals(this.firstName, doctor.firstName) &&
Objects.equals(this.lastName, doctor.lastName) &&
Objects.equals(this.email, doctor.email) &&
Objects.equals(this.password, doctor.password) &&
Objects.equals(this.phone, doctor.phone) &&
Objects.equals(this.avatarUrl, doctor.avatarUrl) &&
Objects.equals(this.Doctorvotes, doctor.Doctorvotes);
}

@Override
public int hashCode() {
return Objects.hash(id, Doctorname, firstName, lastName, email, password, phone, avatarUrl, Doctorvotes);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Doctor {\n");

sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" Doctorname: ").append(toIndentedString(Doctorname)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n");
sb.append(" Doctorvotes: ").append(toIndentedString(Doctorvotes)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

最佳答案

创建doctorRepository bean 时遇到问题,因为 Doctor 类不是托管实体(请参阅堆栈跟踪)。

您需要使用 @Entity 注解您的 Doctor 类,使其成为 Spring 托管实体。

关于java - 新问题 : Exception encountered during context initiali. - 取消。引用。尝试。 : org. springframework.beans.factory.UnsatisfiedDependencyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61620154/

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