. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.0)
2022-06-14 15:28:58.428 INFO 18308 --- [ main] cn.fivk.TravelApplication : Starting TravelApplication using Java 1.8.0_321 on DESKTOP-FSSSN33 with PID 18308 (E:\ideaProject\project\Travel\target\classes started by Fivk in E:\ideaProject\project\Travel)
2022-06-14 15:28:58.430 INFO 18308 --- [ main] cn.fivk.TravelApplication : No active profile set, falling back to 1 default profile: "default"
2022-06-14 15:28:59.152 INFO 18308 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 80 (http)
2022-06-14 15:28:59.158 INFO 18308 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-06-14 15:28:59.158 INFO 18308 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.63]
2022-06-14 15:28:59.271 INFO 18308 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-06-14 15:28:59.271 INFO 18308 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 809 ms
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
2022-06-14 15:28:59.360 INFO 18308 --- [ main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2022-06-14 15:28:59.424 INFO 18308 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
Property 'mapperLocations' was not specified.
_ _ |_ _ _|_. ___ _ | _
| | |\/|_)(_| | |_\ |_)||_|_\
/ |
3.4.2
This primary key of "id" is primitive !不建议如此请使用包装类 in Class: "cn.fivk.entity.User"
2022-06-14 15:28:59.947 INFO 18308 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2022-06-14 15:29:00.083 INFO 18308 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 80 (http) with context path ''
2022-06-14 15:29:00.090 INFO 18308 --- [ main] cn.fivk.TravelApplication : Started TravelApplication in 1.953 seconds (JVM running for 2.51)
2022-06-14 15:29:00.092 INFO 18308 --- [ main] cn.fivk.TravelApplication : 项目启动成功
问题原因
id 的封装应该使用Integer
如果用int
的话id
的默认值会是0
,会出现一些问题,比如在mypatisplus
使用save
时就不能使用算法生成id
了,这样会生成id
为0
的数据,如果有唯一或者主键约束的话,下一次生成就会报错。