- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我在这里发表的第一篇文章。我是初学者。我正在开发一个 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/
说真的,你怎么能在不发疯的情况下处理所有这些异常呢?我是不是读了太多关于异常处理的文章或什么?我尝试重构了几次,但每次似乎都以更糟糕的结果告终。也许我应该承认确实会发生异常(exception)情况,
背景 两者 try/rescue和 try/catch是 Elixir 中的错误处理技术。根据 corresponding chapter在介绍指南中。 Errors can be rescued u
每当我尝试在 Raspberry PI 上运行此 python 脚本时,我都会遇到问题: import socket import sys # Create a TCP/IP socket sock
我想知道一些关于 PHP 的 try , catch声明。 让我们考虑以下示例。 abstract class ExceptionA extends Exception {} class Except
我的 laravel v5.4 项目中有两个模型,user 和 admin。 在 config/auth.php 中,我向守卫和提供者添加了管理员,如下所示: 'guards' => [ 'w
try: r = requests.get(url, params={'s': thing}) except requests.ConnectionError, e: print e
我有以下代码。 但是,它并不能捕获所有错误,而我仍然会收到“throw er;//未处理的'错误'事件”。 为什么是这样? app.post('/api/properties/zip/:zip/bed
问题与细节 我正在使用自定义错误处理,遇到的错误之一是“路径中的非法字符”。我有一个自定义函数,旨在通过路径字符串查找此类非法字符,并在找到它们时引发自定义错误。但是我发现,取决于非法字符,Test-
This question already has answers here: How do I catch a numpy warning like it's an exception (not j
我正在使用其他人的代码,但我不熟悉try/catch,因此我举了一个类似的小例子。在第11行上,如果我写了error(''),似乎没有发现错误并增加了索引j。但是,编写error(' ')或error
我在我的一个程序中遇到了这个问题,在这种情况下,尝试/异常(exception)的错误使程序变得更好,以防用户意外输入了他们不应该输入的内容。它仍然给我错误,我为为什么感到困惑。如果对我的问题确实很重
我在尝试TRY ... CATCH块时遇到问题。有人可以解释为什么以下代码无法执行我的sp吗? DECLARE @Result int SET @Result = 0 BEGIN TRY SE
我有一个相当大的 powershell 脚本,其中包含许多(20 多个)执行各种操作的函数。 现在所有代码实际上都没有任何错误处理或重试功能。如果某个特定的任务/功能失败,它就会失败并继续。 我想改进
为什么我尝试时需要导入 inputmismatchException catch(InputMismatchException e){ System.out.println("
我对此感到困惑 - 我为辅助方法编写了一个 try/catch 。它的目的是捕获任何无效输入(任何不是“男性”或“女性”的内容(没有特定情况)。如果输入无效,它将通知用户,然后让他们重试。如果有效,则
我有时会发现自己处于如下场景。尽可能简单地陈述问题 “有时我会创建一段代码,Java 让我将其包含在 try/catch 语句中。我没有使用 catch,所以我将其留空。为什么这是错误的?” boo
我有点困惑为什么当我不使用 Try block 时会出现 Try block 错误。 我在代码块底部附近收到错误通知。如果我不使用 try/catch,有人可以向我解释为什么会发生这种情况吗? 它是否
我已经盯着我的电脑两个小时了,我不知道我做错了什么。谁能帮助我看到光明? package blackjack; import java.util.Random; import java.util.Sc
我想将方法保存在 Enum 中,但 Class.getDeclaredMethod 抛出 NoSuchMethodException,那么我该如何处理呢?我的代码: public enum Car
这个问题已经有答案了: Executing multi-line statements in the one-line command-line (18 个回答) 已关闭 3 年前。 如何使用try.
我是一名优秀的程序员,十分优秀!