- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对我当前正在进行的项目添加了一些更改。我有一个用户类别和 3 个不同的配置文件(管理员、医生、患者)。
我通过添加两个用户子类(Docteur 和 Patient)来更改项目的结构,并且配置文件是 User 或 admin。
用户:
package com.vivalio.springmvc.model;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotEmpty;
@Entity
@Table(name = "USER")
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@NotEmpty
@Column(name = "SSO_ID", unique = true, nullable = false)
private String ssoId;
@NotEmpty
@Column(name = "PASSWORD", nullable = false)
private String password;
@NotEmpty
@Column(name = "FIRST_NAME", nullable = false)
private String firstName;
@NotEmpty
@Column(name = "LAST_NAME", nullable = false)
private String lastName;
@NotEmpty
@Column(name = "EMAIL", nullable = false)
private String email;
@Column(name = "DTCREATION", nullable = true)
private String dateCreation;
@Column(name = "JJCREATION", nullable = true)
private String jjCreation;
public String getJjCreation() {
return jjCreation;
}
public void setJjCreation(String jjCreation) {
this.jjCreation = jjCreation;
}
@Column(name = "MMCREATION", nullable = true)
private String mmCreation;
public String getMmCreation() {
return mmCreation;
}
public void setMmCreation(String mmCreation) {
this.mmCreation = mmCreation;
}
@Column(name = "YYCREATION", nullable = true)
private String aaCreation;
public String getAaCreation() {
return aaCreation;
}
public void setAaCreation(String aaCreation) {
this.aaCreation = aaCreation;
}
public String getDateCreation() {
return dateCreation;
}
public void setDateCreation(String dateCreation) {
this.dateCreation = dateCreation;
}
@NotEmpty
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "USER_USER_PROFILE", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = {
@JoinColumn(name = "USER_PROFILE_ID") })
private Set<UserProfile> userProfiles = new HashSet<UserProfile>();
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSsoId() {
return ssoId;
}
public void setSsoId(String ssoId) {
this.ssoId = ssoId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Set<UserProfile> getUserProfiles() {
return userProfiles;
}
public void setUserProfiles(Set<UserProfile> userProfiles) {
this.userProfiles = userProfiles;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((ssoId == null) ? 0 : ssoId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof User))
return false;
User other = (User) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (ssoId == null) {
if (other.ssoId != null)
return false;
} else if (!ssoId.equals(other.ssoId))
return false;
return true;
}
@Override
public String toString() {
return "User [id=" + id + ", ssoId=" + ssoId + ", password=" + password + ", firstName=" + firstName
+ ", lastName=" + lastName + ", email=" + email + "]";
}
}
博士:
package com.vivalio.springmvc.model;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "DOCTEUR")
public class Docteur extends User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@OneToMany(mappedBy = "doc")
private Set<Patient> patients = new HashSet<Patient>(0);
public Set<Patient> getPatients() {
return patients;
}
public void setPatients(Set<Patient> patients) {
this.patients = patients;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
患者:
package com.vivalio.springmvc.model;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "PATIENT")
public class Patient extends User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@OneToMany(mappedBy = "patient")
private Set<Consultation> consultations = new HashSet<Consultation>(0);
@ManyToOne
@JoinColumn(name = "id")
private Docteur doc;
public Docteur getDoc() {
return doc;
}
public void setDoc(Docteur doc) {
this.doc = doc;
}
public Set<Consultation> getConsultations() {
return consultations;
}
public void setConsultations(Set<Consultation> consultations) {
this.consultations = consultations;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
转换器:
package com.vivalio.springmvc.converter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import com.vivalio.springmvc.model.UserProfile;
import com.vivalio.springmvc.service.UserProfileService;
/**
* A converter class used in views to map id's to actual userProfile objects.
*/
@Component
public class RoleToUserProfileConverter implements Converter<Object, UserProfile>{
static final Logger logger = LoggerFactory.getLogger(RoleToUserProfileConverter.class);
@Autowired
UserProfileService userProfileService;
/**
* Gets UserProfile by Id
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
*/
public UserProfile convert(Object element) {
Integer id = Integer.parseInt((String)element);
UserProfile profile= userProfileService.findById(id);
logger.info("Profile : {}",profile);
return profile;
}
}
Controller :
package com.vivalio.springmvc.controller;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.security.authentication.AuthenticationTrustResolver;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.vivalio.springmvc.model.Consultation;
import com.vivalio.springmvc.model.User;
import com.vivalio.springmvc.model.UserProfile;
import com.vivalio.springmvc.model.UserProfileType;
import com.vivalio.springmvc.service.AppetitService;
import com.vivalio.springmvc.service.BouleService;
import com.vivalio.springmvc.service.ConsultationService;
import com.vivalio.springmvc.service.DocteurService;
import com.vivalio.springmvc.service.DouleurService;
import com.vivalio.springmvc.service.FaiblesseService;
import com.vivalio.springmvc.service.PatientService;
import com.vivalio.springmvc.service.UserProfileService;
import com.vivalio.springmvc.service.UserService;
import com.vivalio.springmvc.utils.Mail;
@Controller
@RequestMapping("/")
@SessionAttributes("roles")
public class AppController {
@Autowired
UserService userService;
@Autowired
UserProfileService userProfileService;
@Autowired
AppetitService appetitService;
@Autowired
FaiblesseService faiblesseService;
@Autowired
DouleurService douleurService;
@Autowired
BouleService bouleService;
@Autowired
MessageSource messageSource;
@Autowired
PersistentTokenBasedRememberMeServices persistentTokenBasedRememberMeServices;
@Autowired
AuthenticationTrustResolver authenticationTrustResolver;
@Autowired
ConsultationService consultationService;
@Autowired
PatientService patientService;
@Autowired
DocteurService docteurServices;
/**
* This method will list all existing users.
*/
@RequestMapping(value = { "/", "/list" }, method = RequestMethod.GET)
public String listUsers(ModelMap model) {
List<User> users = userService.findAllUsers();
model.addAttribute("users", users);
model.addAttribute("loggedinuser", getPrincipal());
return "userslist";
}
/**
* This method will provide the medium to add a new user.
*/
@RequestMapping(value = { "/newuser" }, method = RequestMethod.GET)
public String newUser(ModelMap model) {
User user = new User();
model.addAttribute("user", user);
model.addAttribute("edit", false);
model.addAttribute("loggedinuser", getPrincipal());
return "registration";
}
@RequestMapping(value = { "/newconsultation" }, method = RequestMethod.GET)
public String newConsultation(ModelMap model) {
Consultation consultation = new Consultation();
model.addAttribute("consultation", consultation);
model.addAttribute("edit", false);
model.addAttribute("loggedinuser", getPrincipal());
return "registrationConsultation";
}
@RequestMapping(value = { "/newuser" }, method = RequestMethod.POST)
public String saveUser(@Valid User user, BindingResult result, ModelMap model) {
if (result.hasErrors()) {
return "registration";
}
if (!userService.isUserSSOUnique(user.getId(), user.getSsoId())) {
FieldError ssoError = new FieldError("user", "ssoId", messageSource.getMessage("non.unique.ssoId",
new String[] { user.getSsoId() }, Locale.getDefault()));
result.addError(ssoError);
return "registration";
}
userService.saveUser(user);
Mail.sendMailRegistration("support@xxxxxxx.net", user.getEmail(), "xxxxxx@gmail.com",
"xxxxxx@gmail.com", "Creation de compte vivalio", "message");
model.addAttribute("success",
"User " + user.getFirstName() + " " + user.getLastName() + " registered successfully");
model.addAttribute("loggedinuser", getPrincipal());
// return "success";
return "redirect:/list";
}
/* ajouter la consultation du patient */
@RequestMapping(value = "/newconsultation", method = RequestMethod.POST)
public String saveConsultation(@Valid Consultation consultation, BindingResult result, ModelMap model) {
if (result.hasErrors()) {
return "registrationConsultation";
}
// Patient patient = (Patient) getUser();
consultation.setPatient(null);
consultationService.saveConsultation(consultation);
if (consultation != null && consultation.getPatient() != null) {
Mail.sendMailAfterConsultation("support@xxxxxxx.net", consultation.getPatient().getEmail(),
"xxxxxx@gmail.com", "xxxxxxx@gmail.com", "Envoi de la consultation a votre medecin : ",
"Votre consultation REF-" + consultation.getId()
+ " a ete envoyee a votre medecin avec succes. Vous serez contacte en cas d'urgence.<br/>Ci dessous un recap de votre consultation :<br/>"
+ "<br/>Poid : " + consultation.getParam1() + "<br/>" + "Appetit :"
+ consultation.getParam2() + "<br/>" + "Faiblesse :" + consultation.getParam3() + "<br/>"
+ "Douleur :" + consultation.getParam4() + "<br/>" + "Boule :" + consultation.getParam5()
+ "<br/>" + "Fievre :" + consultation.getParam6() + "<br/>" + "Commentaire :"
+ consultation.getCommentaire() + "<br/>" + "<br/>L'equipe vivalio Group"
);
}
model.addAttribute("param1", consultation.getParam1());
model.addAttribute("param2", consultation.getParam2());
model.addAttribute("param3", consultation.getParam3());
model.addAttribute("param4", consultation.getParam4());
model.addAttribute("param5", consultation.getParam5());
model.addAttribute("param6", consultation.getParam6());
model.addAttribute("commentaire", consultation.getCommentaire());
return "redirect:/list";
}
/**
* This method will provide the medium to update an existing user.
*/
@RequestMapping(value = { "/edit-user-{ssoId}" }, method = RequestMethod.GET)
public String editUser(@PathVariable String ssoId, ModelMap model) {
User user = userService.findBySSO(ssoId);
model.addAttribute("user", user);
model.addAttribute("edit", true);
model.addAttribute("loggedinuser", getPrincipal());
return "registration";
}
@RequestMapping(value = { "/edit-user-{ssoId}" }, method = RequestMethod.POST)
public String updateUser(@Valid User user, BindingResult result, ModelMap model, @PathVariable String ssoId) {
if (result.hasErrors()) {
return "registration";
}
userService.updateUser(user);
Mail.sendMailRegistration("support@xxxxx.net", user.getEmail(), "xxxxxxxx@gmail.com",
"xxxxxxxx@gmail.com", "Modification des informations vivalio",
"Votre utilisateur vivalio a été modifié");
model.addAttribute("success",
"User " + user.getFirstName() + " " + user.getLastName() + " updated successfully");
model.addAttribute("loggedinuser", getPrincipal());
return "redirect:/list";
}
/**
* This method will delete an user by it's SSOID value.
*/
@RequestMapping(value = { "/delete-user-{ssoId}" }, method = RequestMethod.GET)
public String deleteUser(@PathVariable String ssoId) {
userService.deleteUserBySSO(ssoId);
return "redirect:/list";
}
/**
* This method will provide UserProfile list to views
*/
@ModelAttribute("roles")
public List<UserProfile> initializeProfiles() {
return userProfileService.findAll();
}
/**
* This method will provide Docs list to views
*/
@ModelAttribute("docteurs")
public List<User> initializeAllDocs() {
return userService.findAllDocs();
}
/**
* This method will provide Appetit list to views
*/
@ModelAttribute("appetits")
public List<String> initializeAppetits() {
return appetitService.findAll();
}
/**
* This method will provide Faiblesse list to views
*/
@ModelAttribute("faiblesses")
public List<String> initializeFaiblesses() {
return faiblesseService.findAll();
}
/**
* This method will provide Douleur list to views
*/
@ModelAttribute("douleurs")
public List<String> initializeDouleurs() {
return douleurService.findAll();
}
/**
* This method will provide Boules list to views
*/
@ModelAttribute("boules")
public List<String> initializeBoules() {
return bouleService.findAll();
}
/**
* This method handles Access-Denied redirect.
*/
@RequestMapping(value = "/Access_Denied", method = RequestMethod.GET)
public String accessDeniedPage(ModelMap model) {
model.addAttribute("loggedinuser", getPrincipal());
return "accessDenied";
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage() {
if (isCurrentAuthenticationAnonymous()) {
return "login";
} else {
return "redirect:/list";
}
}
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logoutPage(HttpServletRequest request, HttpServletResponse response) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null) {
// new SecurityContextLogoutHandler().logout(request, response,
// auth);
persistentTokenBasedRememberMeServices.logout(request, response, auth);
SecurityContextHolder.getContext().setAuthentication(null);
}
return "redirect:/login?logout";
}
/**
* This method returns the principal[user-name] of logged-in user.
*/
private String getPrincipal() {
String userName = null;
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal instanceof UserDetails) {
userName = ((UserDetails) principal).getUsername();
} else {
userName = principal.toString();
}
return userName;
}
@SuppressWarnings("rawtypes")
private User getUser() {
String username = null;
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
username = ((UserDetails) principal).getUsername();
User usr = userService.findBySSO(username);
return usr;
}
/**
* This method returns true if users is already authenticated [logged-in],
* else false.
*/
private boolean isCurrentAuthenticationAnonymous() {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return authenticationTrustResolver.isAnonymous(authentication);
}
/**
* This method will redirect to dashboard
*/
@RequestMapping(value = { "/board" }, method = RequestMethod.GET)
public String tableauBord(ModelMap model, HttpSession session) {
List<User> users = userService.findAllUsers();
// TOTAL des utilisateurs de la base
int totalAdmin = userService.findAllAdmins().size();
int totalDocs = userService.findAllDocs().size();
int totalPatients = userService.findAllPatients().size();
// ANNEE COURANTE
int year = Calendar.getInstance().get(Calendar.YEAR);
StringBuilder sbyear = new StringBuilder();
sbyear.append(year);
// RECHERCHER LES COMPTES PAR TYPE DE L'ANNEE EN COURS
List<Object[]> totalComptesAdminParMois = userService
.findAllUsersByTypeAndyear(UserProfileType.ADMINISTRATEUR.getUserProfileType(), sbyear.toString());
List<Object[]> totalComptesDocParMois = userService
.findAllUsersByTypeAndyear(UserProfileType.ADMINISTRATEUR.getUserProfileType(), sbyear.toString());
List<Object[]> totalComptesPatParMois = userService
.findAllUsersByTypeAndyear(UserProfileType.UTILISATEUR.getUserProfileType(), sbyear.toString());
return "board";
}
}
尝试重新启动服务器时,消息对象中出现错误。
AppConfig
package com.vivalio.springmvc.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
import com.vivalio.springmvc.converter.RoleToUserProfileConverter;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.vivalio.springmvc")
public class AppConfig extends WebMvcConfigurerAdapter{
@Autowired
RoleToUserProfileConverter roleToUserProfileConverter;
/**
* Configure ViewResolvers to deliver preferred views.
*/
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setViewClass(JstlView.class);
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".jsp");
registry.viewResolver(viewResolver);
}
/**
* Configure ResourceHandlers to serve static resources like CSS/ Javascript etc...
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("/static/");
}
/**
* Configure Converter to be used.
* In our example, we need a converter to convert string values[Roles] to UserProfiles in newUser.jsp
*/
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverter(roleToUserProfileConverter);
}
/**
* Configure MessageSource to lookup any validation/error message in internationalized property files
*/
@Bean
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("messages");
return messageSource;
}
/**Optional. It's only required when handling '.' in @PathVariables which otherwise ignore everything after last '.' in @PathVaidables argument.
* It's a known bug in Spring [https://jira.spring.io/browse/SPR-6164], still present in Spring 4.1.7.
* This is a workaround for this issue.
*/
@Override
public void configurePathMatch(PathMatchConfigurer matcher) {
matcher.setUseRegisteredSuffixPatternMatch(true);
}
}
堆栈跟踪
SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.vivalio.springmvc.converter.RoleToUserProfileConverter com.vivalio.springmvc.configuration.AppConfig.roleToUserProfileConverter; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleToUserProfileConverter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.vivalio.springmvc.service.UserProfileService com.vivalio.springmvc.converter.RoleToUserProfileConverter.userProfileService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.vivalio.springmvc.dao.UserProfileDao com.vivalio.springmvc.service.UserProfileServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userProfileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.vivalio.springmvc.dao.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/vivalio/springmvc/configuration/HibernateConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.hibernate.mapping.SingleTableSubclass cannot be cast to org.hibernate.mapping.RootClass at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
最佳答案
这是异常的根本原因:
org.hibernate.mapping.SingleTableSubclass cannot be cast to org.hibernate.mapping.RootClass
这意味着您在子类和父类中都有@Id
。
从两个子类中删除@Id
字段,它们将从父类继承它。
第二个问题是您的 @JoinColumn
与 @Id
同名
@ManyToOne
@JoinColumn(name = "doc_id") // give some unique column name here
private Docteur doc;
<小时/>
P.S.与问题无关的小建议:
您的 Controller
中有 10 多个 @Autowired
依赖项。这确实不是一个设计类的好方法。每当在一个类中观察到太多的 @Autowired
依赖项时,就会触发您思考应用程序设计 - 这个类承担了太多的责任。
关于java - org.springframework.beans.factory.BeanCreationException : Error creating bean with name 'appConfig' : Injection of autowired dependencies failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45472086/
reqwest v0.9 将 serde v1.0 作为依赖项,因此实现 converting serde_json errors into reqwest error . 在我的代码中,我使用 se
我有这个代码: let file = FileStorage { // ... }; file.write("Test", bytes.as_ref()) .map_err(|e| Mu
我只是尝试用angular-cli创建一个新项目,然后运行服务器,但是它停止并显示一条有趣的消息:Error: No errors。 我以这种方式更新了(希望有帮助):npm uninstall -g
我从我的 javascript 发送交易 Metamask 打开传输对话框 我确定 i get an error message in metamask (inpage.js:1 MetaMask -
这个问题在这里已经有了答案: How do you define custom `Error` types in Rust? (3 个答案) How to get a reference to a
我想知道两者之间有什么大的区别 if let error = error{} vs if error != nil?或者只是人们的不同之处,比如他们如何用代码表达自己? 例如,如果我使用这段代码: u
当我尝试发送超过 50KB 的图像时,我在 Blazor 服务器应用程序上收到以下错误消息 Error: Connection disconnected with error 'Error: Serv
我有一个error-page指令,它将所有异常重定向到错误显示页面 我的web.xml: [...] java.lang.Exception /vi
我有这样的对象: address: { "phone" : 888, "value" : 12 } 在 WHERE 中我需要通过 address.value 查找对象,但是在 SQL 中有函数
每次我尝试编译我的代码时,我都会遇到大量错误。这不是我的代码的问题,因为它在另一台计算机上工作得很好。我尝试重新安装和修复,但这没有帮助。这是整个错误消息: 1>------ Build starte
在我的代码的类部分,如果我写一个错误,则在不应该的情况下,将有几行报告为错误。我将'| error'放在可以从错误中恢复的良好/安全位置,但是我认为它没有使用它。也许它试图在某个地方恢复中间表情? 有
我遇到了 csv 输入文件整体读取故障的问题,我可以通过在 read_csv 函数中添加 "error_bad_lines=False" 来删除这些问题来解决这个问题。 但是我需要报告这些造成问题的文
在 Spring 中,验证后我们在 controller 中得到一个 BindingResult 对象。 很简单,如果我收到验证错误,我想重新显示我的表单,并在每个受影响的字段上方显示错误消息。 因此
我不知道出了什么问题,因为我用 Java 编程了大约一年,从来没有遇到过这个错误。在一分钟前在 Eclipse 中编译和运行工作,现在我得到这个错误: #A fatal error has been
SELECT to_char(messages. TIME, 'YYYY/MM/DD') AS FullDate, to_char(messages. TIME, 'MM/DD
我收到这些错误: AnonymousPath\Anonymized.vb : error BC30037: Character is not valid. AnonymousPath\Anonymiz
我刚刚安装了 gridengine 并在执行 qstat 时出现错误: error: commlib error: got select error (Connection refused) erro
嗨,我正在学习 PHP,我从 CRUD 系统开始,我在 Windows 上安装了 WAMP 服务器,当我运行它时,我收到以下错误消息。 SCREAM: Error suppression ignore
我刚刚开始一个新项目,我正在学习核心数据教程,可以找到:https://www.youtube.com/watch?v=zZJpsszfTHM 我似乎无法弄清楚为什么会抛出此错误。我有一个名为“Exp
当我使用 Jenkins 运行新构建时,出现以下错误: "FilePathY\XXX.cpp : fatal error C1853: 'FilePathZ\XXX.pch' precompiled
我是一名优秀的程序员,十分优秀!