1.如果报“main”错误 那基本是注释少写了其中的注释
@Autowired 注入
@Service 服务层注解
@Transactional 开启事务(事务回滚)
@RequestMapping(“请求页面”) 请求地址
@DataTimeFormot(“yyyy-mm-dd”) 时间
@PathVariable(value=“xxx”) 获取地址值
2.如果报Process terminated错误,那就看看pom配置文件里的东西
配置的项目名不能有空格。
3.如果报booktype
(typeid
))
com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (backup
.book
, CONSTRAINT FK_BOOK_TYPEID
FOREIGN KEY (typeid
) REFERENCES booktype
(typeid
))
一般是数据库主键错误
4.日期格式转换错误
Resolved exception caused by handler execution: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type ‘java.lang.String’ to required type ‘java.util.Date’; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.util.Date] for value ‘2019-12-03’; nested exception is java.lang.IllegalArgumentException
在Date前加上注解
@DateTimeFormat(pattern ="yyyy-MM-dd" )Date brithday