Raysmond / SpringBlog

A simple blogging system implemented with Spring Boot + Hibernate + MySQL + Bootstrap4.
http://raysmond.com
BSD 3-Clause "New" or "Revised" License
1.64k stars 695 forks source link

你好,项目导入eclipse中后,实体没有getter、setter方法,造成create service失败 #2

Closed yaotj closed 8 years ago

yaotj commented 8 years ago

Caused by: java.lang.Error: Unresolved compilation problem: The method getPassword() is undefined for the type User

at com.raysmond.blog.services.UserService.createUser(UserService.java:38)
at com.raysmond.blog.services.UserService.getSuperUser(UserService.java:46)
at com.raysmond.blog.services.UserService.initialize(UserService.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
... 44 more

当我添加上getter、setter方法就ok了,是我少导入jar包了吗?

Raysmond commented 8 years ago

Eclipse需要安装一个lombok插件,这个插件会自动生成getter和setter方法。

yaotj commented 8 years ago

谢谢,添加插件后就可以了。

Raysmond commented 8 years ago

good luck