- 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/
这个问题在这里已经有了答案: Python try...except comma vs 'as' in except (5 个回答) 关闭7年前。 在python中,有两种方法可以捕获异常 excep
在 Java 中,我有一个从 Exception 扩展的异常类,但是每当我抛出它时,编译器都会说它需要被捕获/必须声明方法 throws异常。 当我使用从 Exception 扩展的 RuntimeE
我有一组用户、组以及用户和组之间的映射。我有各种操作这些集合的函数,但是不能为不存在的用户添加用户组映射,也不能删除仍然有用户作为成员的组等。 所以基本上我希望这些函数抛出必须由调用者明确处理的“异常
我正在尝试使用上载控件上载20兆的文件,并且在Visual Studio的内置Web服务器上可以正常工作,但是一旦将其发布到生产服务器(我无权访问),我总是收到以下错误消息: Server Error
我想断言运行某些代码时会引发特定异常(SSLHandshakeException)。 assertThatThrownBy(() -> { // some code }).is
这个问题我暂时解决不了。我很乐意提供一些建议。 当我尝试抛出异常时(我自己创建了一个 Java 风格的异常) throw Exception (); 编译器提出抗议: DataTypes/Date.c
我有以下文件: from fabric.api import env, execute, run env.hosts = ['1.2.3.4'] def taskA(): run('ls')
我正在阅读一些包含类似于以下功能的源代码: def dummy_function(): try: g = 1/0 except Exception as e:
根据标准 ML 的定义(修订版): The idea is that dynamic evaluation of a non-expansive expression will neither gen
当 GHCi 在运行时发现调用产生的值与函数的模式匹配不匹配时,有没有办法让 GHCi 产生更好的异常消息? 它目前给出了产生非详尽模式匹配的函数的行号,虽然有时会有所帮助,但确实需要一轮调试,有时我
我有一个最佳实践问题。我意识到这是主观的,但想问问比我更聪明的人,这是否是一种常见的编程实践。 如果您有一种不希望干扰应用程序重要功能的非关键方法,那么使用这样的错误接收器是否常见? Try
在编程中,异常是否总是错误(被零除,访问冲突等等)? 如果不是,您能否提供不是错误的异常示例? 谢谢。 最佳答案 异常通常用于管理错误,它们使错误处理更加容易,但它们并不总是错误。 任何需要单独代码路
我很想知道 OCaml 运行时如何处理异常以使它们如此轻量。他们是使用 setjmp/longjmp 还是在每个函数中返回一个特殊值并传播它? 在我看来,longjmp会给系统带来一点压力,但只有在引
在我的 C# 代码中,我可以访问 MyNamespace.Exception 以及 System.Exception。当我想捕获其中一个异常时,理想情况下我会完全限定要捕获的异常或使用别名来明确说明。
我正在使用 Visual C++ 2005 Express Edition 并遇到以下链接器错误: 19>mylib1.lib(mylibsource1.obj) : error LNK2019: u
这个问题在这里已经有了答案: Is there "Break on Exception" in IntelliJ? (6 个回答) 关闭7年前。 我想在调试器中运行我的测试套件并中断任何意外异常,但是
Like in this picture 我知道它们都可以正常工作,但我只是想知道它们之间有何不同? PS:我是初学者。 最佳答案 A LogEvent可以同时包含消息和异常。如果您使用第一种形式:
我知道避免 Doctrine 上的异常似乎是一种奇怪的行为,但我需要这样做,因为我在一个旧项目中工作,过去有人执行了一些迁移,然后他决定删除它,所以现在复制起来很复杂本地生产环境没有崩溃,这就是为什么
我想创建一个名为 SecurityException 的新异常。 我应该把代码放在哪里? class SecurityException extends CakeException {}; 谢谢! 最
我一直在使用throw new Exception("...")在我的代码中,因为我找不到其他可以使用的东西。我正在寻找像 C++'s 这样的东西 out_of_range 和 logic_error
我是一名优秀的程序员,十分优秀!