How to avoid getter and setter springboot entity? - Stack ...
文章推薦指數: 80 %
Is there a way to avoid getter and setter in the spring-boot entity, sometimes I have a lot of columns in the database?
Home
Public
Questions
Tags
Users
Collectives
ExploreCollectives
FindaJob
Jobs
Companies
Teams
StackOverflowforTeams
–Collaborateandshareknowledgewithaprivategroup.
CreateafreeTeam
WhatisTeams?
Teams
CreatefreeTeam
CollectivesonStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
Howtoavoidgetterandsetterspringbootentity?
AskQuestion
Asked
1year,11monthsago
Modified
1year,11monthsago
Viewed
2ktimes
2
Isthereawaytoavoidgetterandsetterinthespring-bootentity,sometimesIhavealotofcolumnsinthedatabase?
javaspring-bootgetter-setter
Share
Follow
editedApr26,2020at13:55
NitinBisht
4,54644goldbadges1212silverbadges2525bronzebadges
askedApr22,2020at10:00
AbdAbughazalehAbdAbughazaleh
2,58811goldbadge2323silverbadges3838bronzebadges
3
3
Youcanuselombok.Itisajavalibrary.Referprojectlombok.org/features/Data
– NitinBisht
Apr22,2020at10:00
@NitinBishtlomboksolvedmyproblemthankyou.
– AbdAbughazaleh
Apr25,2020at14:23
Yesthankyou,andifthequestionwascorrectupvotequestionalso.
– AbdAbughazaleh
Apr26,2020at11:25
Addacomment
|
1Answer
1
Sortedby:
Resettodefault
Highestscore(default)
Datemodified(newestfirst)
Datecreated(oldestfirst)
4
YoucanuseLombok.Itisasmalljavalibrarythatcanbeusedtoreducetheamountofboilerplatejavacode.Lombokdoesthisviaannotationsthatcanbeaddedtothejavaclasses.
Forgetters/settersLombokprovides@Getterand@Setterannotations.Youcanaddittoclassdatafields.itwillgenerategetterandsettersinthebackground.
Note:Fordetailedinformationreferhttps://projectlombok.org/features/GetterSetter
Share
Follow
answeredApr26,2020at13:54
NitinBishtNitinBisht
4,54644goldbadges1212silverbadges2525bronzebadges
Addacomment
|
YourAnswer
ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers.
Draftsaved
Draftdiscarded
Signuporlogin
SignupusingGoogle
SignupusingFacebook
SignupusingEmailandPassword
Submit
Postasaguest
Name
Email
Required,butnevershown
PostYourAnswer
Discard
Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy
Nottheansweryou'relookingfor?Browseotherquestionstaggedjavaspring-bootgetter-setteroraskyourownquestion.
TheOverflowBlog
AIandnanotechnologyareworkingtogethertosolvereal-worldproblems
FeaturedonMeta
WhatgoesintositesponsorshipsonSE?
StackExchangeQ&AaccesswillnotberestrictedinRussia
AskWizardforNewUsersFeatureTestisnowLive
NewUserExperience:DeepDiveintoourResearchontheStagingGround–How...
Related
3736
HowdoIefficientlyiterateovereachentryinaJavaMap?
1808
SortaMap
延伸文章資訊
- 1@Getter and @Setter - Project Lombok
Overview. You can annotate any field with @Getter and/or @Setter , to let lombok generate the def...
- 2Day 08 - Spring Boot JPA 與Lombok 套件& DAO - iT 邦幫忙
上一篇我們會發現,當我們要建立實體(Entity)時,必須將屬性增加getter & setter 方法,而程式碼會導致存在許多getterr 與setter,此時我們就可以使用Java Lib...
- 3How to avoid getter and setter springboot entity? - Stack ...
Is there a way to avoid getter and setter in the spring-boot entity, sometimes I have a lot of co...
- 4Getter and Setter in Java - GeeksforGeeks
Getter and Setter are methods used to protect your data and make your code more secure. ... Sprin...
- 5Omitting Getter or Setter in Lombok | Baeldung
Learn how to skip the generation of individual getters and setters when using Lombok annotations.