Spring Boot with Lombok: Part 1

文章推薦指數: 80 %
投票人數:10人

Project Lombok is a Java library tool that generates code for minimizing boilerplate code. The library replaces boilerplate code with easy-to-use ... HomeStartHereCoursesIntrotoSpring(Free)SpringFramework5SpringBootMicroservicesTestingSpringBootSpringSecurityCoreSpringFramework4ApacheMavenDockerforJavaDevelopersSQLBeginnertoGuruGuruGearMyCoursesBlogWriteforSFGAboutContactSpringBootwithLombok:Part1Home›Blog›SpringBootwithLombok:Part1ProjectLombokisaJavalibrarytoolthatgeneratescodeforminimizingboilerplatecode.Thelibraryreplacesboilerplatecodewitheasy-to-useannotations.Forexample,byaddingacoupleofannotations,youcangetridofcodeclutters,suchasgettersandsettersmethods,constructors,hashcode,equals,andtoStringmethods,andsoon.ThisisPart1oftheSpringBootwithLombokpost.InthispartI’lldiscussthefollowingLombokconstructs:varandval@Getter,@Setter@NoArgsConstructor,@AllArgsConstructor@Data@NotNullLombokDependencyTouseLombokinyourproject,addthelombokdependencytotheMavenPOM,likethis. org.projectlombok lombok 1.18.8 provided Note:Ifyou’reusingaSpringBootPOM,ProjectLombokisacurateddependency.Thus,youcanomittheversion(whichwillthenbeinheritedfromtheSpringBootparentPOM).valandvarYoucanusevalasthetypeofalocalvariableinsteadofwritingtheactualtype.Lombokinfersthetypefromtheinitializerexpression.Lombokwillalsomarkthelocalvariableasfinal.varworksexactlylikeval,exceptthelocalvariableisnotmarkedasfinal.Thecodeforusingvalandvaristhis.packageguru.springframework.domain.valandvar; importjava.math.BigDecimal; importjava.util.ArrayList; importlombok.val; publicclassValAndVarUserDemo{ publicStringvalCheck(){ /* valmakeslocalfinalvariable(insidemethod) Tryingtoassignavaluewillresultin Error:java:cannotassignavaluetofinalvariableuserName */ valuserName="HelloWorld"; System.out.println(userName.getClass()); returnuserName.toLowerCase(); } publicObjectvarCheck(){ /* varmakeslocalvariable(insidemethod). Sameasvarbutisnotmarkedfinal */ varmoney=newBigDecimal(53.00); System.out.println(money.getClass()); money=newBigDecimal(80.00); returnmoney; } } ThedecompiledValAndVarUserDemo.classisthis.Note:IfyouareusingIntelliJ,double-clicktheclassfileinsidethetargetfoldertoviewthedecompiledclass.// //Sourcecoderecreatedfroma.classfilebyIntelliJIDEA //(poweredbyFernflowerdecompiler) // packageguru.springframework.domain.valandvar; importjava.math.BigDecimal; publicclassValAndVarUserDemo{ publicValAndVarUserDemo(){ } publicStringvalCheck(){ StringuserName="HelloWorld"; System.out.println("HelloWorld".getClass()); return"HelloWorld".toLowerCase(); } publicObjectvarCheck(){ BigDecimalmoney=newBigDecimal(53.0D); System.out.println(money.getClass()); money=newBigDecimal(80.0D); returnmoney; } } ThecodefortestingtheValAndVarUserDemoclassisthis.packageguru.springframework.domain.valandvar; importorg.junit.After; importorg.junit.Before; importorg.junit.Test; importjava.math.BigDecimal; importstaticorg.junit.Assert.*; publicclassValAndVarUserDemoTest{ privateValAndVarUserDemovalAndVarUserDemo; @Before publicvoidsetUp()throwsException{ valAndVarUserDemo=newValAndVarUserDemo(); } @After publicvoidtearDown()throwsException{ valAndVarUserDemo=null; } @Test publicvoidtestValUsage(){ assertEquals("helloworld",valAndVarUserDemo.valCheck()); } @Test publicvoidtestVarUsage(){ assertEquals(newBigDecimal(80),valAndVarUserDemo.varCheck()); } } @Getterand@SetterYoucanusethe@Getterand@Setterannotationsatboththefieldorclassleveltogenerategettersandsettersforprivatefields.Whenyouusethematthefieldlevel,Lombokgeneratesgettersandsettersonlyforthedecoratedfields.Thecodetousethe@Getterand@Setterannotationsatthefieldlevelisthis.packageguru.springframework.domain.gettersetter; importlombok.Getter; importlombok.Setter; publicclassFieldLevelGetterSetterDemo{ privateintuserId; @Getter@Setter privateStringuserName; @Getter privateintuserAge; publicFieldLevelGetterSetterDemo(intuserAge){ this.userAge=userAge; } } ThiscodeannotatesuserNamewith@[email protected]@Getter.ThedecompiledFieldLevelGetterSetterDemo.classisthis.// //Sourcecoderecreatedfroma.classfilebyIntelliJIDEA //(poweredbyFernflowerdecompiler) // packageguru.springframework.domain.gettersetter; publicclassFieldLevelGetterSetterDemo{ privateintuserId; privateStringuserName; privateintuserAge; publicFieldLevelGetterSetterDemo(intuserAge){ this.userAge=userAge; } publicStringgetUserName(){ returnthis.userName; } publicvoidsetUserName(finalStringuserName){ this.userName=userName; } publicintgetUserAge(){ returnthis.userAge; } } TheprecedingcodeshowsthegetUserName()andsetUserName()methodsthatLombokgeneratesfortheuserNamefield.AlsonotethatLombokgeneratesasinglegetUserAge()methodfortheuserAgefield.ThecodetotesttheFieldLevelGetterSetterDemoclassisthis.packageguru.springframework.domain.gettersetter; importorg.junit.After; importorg.junit.Before; importorg.junit.Test; importstaticorg.junit.Assert.*; publicclassFieldLevelGetterSetterDemoTest{ FieldLevelGetterSetterDemofieldLevelGetterSetterDemo; @Before publicvoidsetUp()throwsException{ fieldLevelGetterSetterDemo=newFieldLevelGetterSetterDemo(28); } @After publicvoidtearDown()throwsException{ fieldLevelGetterSetterDemo=null; } @Test publicvoidtestFieldLevelGetterSetter(){ fieldLevelGetterSetterDemo.setUserName("JohnDoe"); assertEquals("JohnDoe",fieldLevelGetterSetterDemo.getUserName()); } @Test publicvoidtestFieldLevelGetter(){ assertEquals(28,fieldLevelGetterSetterDemo.getUserAge()); } } Whenyouusethe@Getterand@Setterannotationsattheclasslevel,Lombokgeneratesgetterandsettermethodsforallthefields.packageguru.springframework.domain.gettersetter; importlombok.*; /* @Getterand@Setterannotationsforgetterandsettermethods */ @Getter @Setter publicclassGetterSetterUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; } ThedecompiledGetterSetterUserDemo.classisthis.// //Sourcecoderecreatedfroma.classfilebyIntelliJIDEA //(poweredbyFernflowerdecompiler) // packageguru.springframework.domain.gettersetter; publicclassGetterSetterUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; publicGetterSetterUserDemo(){ } publicintgetUserId(){ returnthis.userId; } publicStringgetUserName(){ returnthis.userName; } publicintgetUserAge(){ returnthis.userAge; } publicvoidsetUserId(finalintuserId){ this.userId=userId; } publicvoidsetUserName(finalStringuserName){ this.userName=userName; } publicvoidsetUserAge(finalintuserAge){ this.userAge=userAge; } } Asyoucansee,Lombokgeneratesgetterandsettermethodsforallthefields.ThecodefortestingGetterSetterUserDemoclassisthis.packageguru.springframework.domain.gettersetter; importorg.junit.After; importorg.junit.Before; importorg.junit.Test; importstaticorg.junit.Assert.*; publicclassGetterSetterUserDemoTest{ privateGetterSetterUserDemogetterSetterUserDemo; @Before publicvoidsetUp(){ getterSetterUserDemo=newGetterSetterUserDemo(); } @After publicvoidtearDown(){ getterSetterUserDemo=null; } @Test publicvoidtestGetterSetterAnnotation(){ getterSetterUserDemo.setUserId(101); getterSetterUserDemo.setUserName("JohnDoe"); getterSetterUserDemo.setUserAge(25); assertEquals(101,getterSetterUserDemo.getUserId()); assertEquals("JohnDoe",getterSetterUserDemo.getUserName()); assertEquals(25,getterSetterUserDemo.getUserAge()); } } @NoArgsConstructorand@AllArgsConstructorYoucanusethe@NoArgsConstructorannotationtogeneratethedefaultconstructorthattakesnoarguments.Togenerateaconstructorwithargumentsforallthefield,[email protected]@NoArgsConstructorand@AllArgsConstructorannotationsisthis.packageguru.springframework.domain.constructor; importlombok.*; /* @NoArgsConstructorannotationforgeneratingaconstructorwithnoparameters */ @NoArgsConstructor /* @AllArgsConstructorannotationforgeneratingaconstructor with1parameterforeachfield */ @AllArgsConstructor publicclassConstructorUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; } Intheprecedingcode,wehaveannotatedtheclasswith@NoArgsConstructorand@AllArgsConstructor.Lombokwillgeneratetwoconstructorsinthe.classfile.Onewithoutparametersandtheotherwithaparameterforeachfield.ThedecompiledConstructorUserDemo.classisthis.// //Sourcecoderecreatedfroma.classfilebyIntelliJIDEA //(poweredbyFernflowerdecompiler) // packageguru.springframework.domain.constructor; publicclassConstructorUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; publicConstructorUserDemo(){ } publicConstructorUserDemo(finalintuserId,finalStringuserName,finalintuserAge){ this.userId=userId; this.userName=userName; this.userAge=userAge; } } ThecodefortestingtheConstructorUserDemo.javaisthis.packageguru.springframework.domain.constructor; importlombok.AllArgsConstructor; importlombok.NoArgsConstructor; importorg.junit.After; importorg.junit.Before; importorg.junit.Test; importstaticorg.junit.Assert.*; publicclassConstructorUserDemoTest{ privateConstructorUserDemoconstructorUserDemo; /* test@NoArgsConstructorannotation */ @Test publicvoidtestDataAnnotationForNoArgsConstructor(){ constructorUserDemo=newConstructorUserDemo(); assertNotNull(constructorUserDemo); } /* test@AllArgsConstructorannotation */ @Test publicvoidtestDataAnnotationForAllArgsConstructor(){ constructorUserDemo=newConstructorUserDemo(100,"JohnDoe",25); assertNotNull(constructorUserDemo); } } /pre>@Data@Dataisaconvenientannotationthatcombinesthefeaturesofthefollowingannotations:@ToString@EqualsAndHashCode@Getter@Setter@RequiredArgsConstructorThiscodedemonstratesthe@Dataannotation.packageguru.springframework.domain.data; importlombok.Builder; importlombok.Data; @Data publicclassDataUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; }ThedecompiledDataUserDemo.classisthis.// //Sourcecoderecreatedfroma.classfilebyIntelliJIDEA //(poweredbyFernflowerdecompiler) // packageguru.springframework.domain.data; publicclassDataUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; publicDataUserDemo(){ } publicintgetUserId(){ returnthis.userId; } publicStringgetUserName(){ returnthis.userName; } publicintgetUserAge(){ returnthis.userAge; } publicvoidsetUserId(finalintuserId){ this.userId=userId; } publicvoidsetUserName(finalStringuserName){ this.userName=userName; } publicvoidsetUserAge(finalintuserAge){ this.userAge=userAge; } publicbooleanequals(finalObjecto){ if(o==this){ returntrue; }elseif(!(oinstanceofDataUserDemo)){ returnfalse; }else{ DataUserDemoother=(DataUserDemo)o; if(!other.canEqual(this)){ returnfalse; }elseif(this.getUserId()!=other.getUserId()){ returnfalse; }else{ Objectthis$userName=this.getUserName(); Objectother$userName=other.getUserName(); if(this$userName==null){ if(other$userName==null){ returnthis.getUserAge()==other.getUserAge(); } }elseif(this$userName.equals(other$userName)){ returnthis.getUserAge()==other.getUserAge(); } returnfalse; } } } protectedbooleancanEqual(finalObjectother){ returnotherinstanceofDataUserDemo; } publicinthashCode(){ intPRIME=true; intresult=1; intresult=result*59+this.getUserId(); Object$userName=this.getUserName(); result=result*59+($userName==null?43:$userName.hashCode()); result=result*59+this.getUserAge(); returnresult; } publicStringtoString(){ intvar10000=this.getUserId(); return"DataUserDemo(userId="+var10000+",userName="+this.getUserName()+",userAge="+this.getUserAge()+ ")"; } } Intheprecedingcode,Lombokgeneratedgettersforallfields,settersforallnon-finalfields,toString,equalsandhashCodeimplementationandaconstructor.Totestcodeforthe@Dataannotationisthis.packageguru.springframework.domain.data; importguru.springframework.domain.constructor.ConstructorUserDemo; importorg.junit.After; importorg.junit.Before; importorg.junit.Test; importstaticorg.junit.Assert.*; publicclassDataUserDemoTest{ DataUserDemodataUserDemo; @Before publicvoidsetUp()throwsException{ dataUserDemo=newDataUserDemo(); } @After publicvoidtearDown()throwsException{ dataUserDemo=null; } /* test@Dataannotationforgetterandsetter */ @Test publicvoidtestDataAnnotationForGetterandSetter(){ dataUserDemo.setUserId(101); dataUserDemo.setUserName("JohnDoe"); dataUserDemo.setUserAge(25); assertEquals(101,dataUserDemo.getUserId()); assertEquals("JohnDoe",dataUserDemo.getUserName()); assertEquals(25,dataUserDemo.getUserAge()); System.out.println(dataUserDemo); } /* test@DataannotationfortoString */ @Test publicvoidtestDataAnnotationForToString(){ dataUserDemo.setUserId(101); dataUserDemo.setUserName("JohnDoe"); dataUserDemo.setUserAge(25); assertTrue(dataUserDemo.toString().startsWith(DataUserDemo.class.getSimpleName())); assertTrue(dataUserDemo.toString().endsWith("(userId=101,userName=JohnDoe,userAge=25)")); } /* test@DataannotationforequalsAndHashcode */ @Test publicvoidtestDataAnnotationForEqualsAndHashCode(){ DataUserDemodataUserDemo1=newDataUserDemo(); DataUserDemodataUserDemo2=newDataUserDemo(); assertTrue((dataUserDemo1).equals(dataUserDemo2)); assertEquals(dataUserDemo1.hashCode(),dataUserDemo2.hashCode()); } } @NonNullLombokgeneratesanullcheckstatementifweannotatetheparametersofamethodoraconstructorwith@NonNull.Thiscodeshowstheusageof@NonNull.packageguru.springframework.domain.nonnull; importlombok.AllArgsConstructor; importlombok.NonNull; publicclassNonNullUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; /* @NonNullgenerateanull-checkstatement */ publicNonNullUserDemo(intuserId,@NonNullStringuserName,intuserAge){ this.userId=userId; this.userName=userName; this.userAge=userAge; } } TheprecedingcodeannotatestheuserNameparameteras@NonNull.LombokwillgeneratecodetocheckforuserNameandthrowNullPointerExceptionifuserNameisnull.ThedecompiledNonNullUserDemo.classisthis.// //Sourcecoderecreatedfroma.classfilebyIntelliJIDEA //(poweredbyFernflowerdecompiler) // packageguru.springframework.domain.nonnull; importlombok.NonNull; publicclassNonNullUserDemo{ privateintuserId; privateStringuserName; privateintuserAge; publicNonNullUserDemo(intuserId,@NonNullStringuserName,intuserAge){ if(userName==null){ thrownewNullPointerException("userNameismarkednon-nullbutisnull"); }else{ this.userId=userId; this.userName=userName; this.userAge=userAge; } } } Thetestcodeforthe@NonNullannotationisthis.packageguru.springframework.domain.nonnull; importorg.junit.Test; publicclassNonNullUserDemoTest{ privateNonNullUserDemononNullUserDemo; @Test(expected=NullPointerException.class) publicvoidtestNonNullOnConstruuctorParameter(){ nonNullUserDemo=newNonNullUserDemo(50,null,25); } } SummaryLombokisaconvenienttoolthatallJavadevelopersshouldhaveintheirtoolkit.Itnotonlymakesyoucodeclutter-free,butalsosavesasignificantamountofdevelopmenttime.WhenusingLombokforthefirsttime,youmightstumbleonhowtoconfigureitinyourIDE.InIntelliJ,youneedtohavetheIntelliJLombokplugin.Youalsoneedtoenableannotationprocessing.InIntelliJ,gotoFile->Settings->Build,Execution,Deployment->Compiler->AnnotationProcessors.SelecttheEnableannotationprocessingcheckbox.Aswithallthetoolsandtechnologies,Lombokalsocomeswithitssetofdisadvantages.OnelimitationIseeisthatitiscloselytiedtotheJavacompiler.LombokinternallyusestheannotationprocessorAPIastheentrypoint.ThisAPIonlyallowsthecreationofnewfilesduringthecompilationandnotthemodificationoftheexistingfiles.LombokmakesheavyusageofitsowninternalAPIsforconfiguringthecompiler.Soyoumustbeawarethatupgradingyourcompilermightbreakyourcode.But,bysayingso,Lombokbeingamaturedtoolwithhugeadoption,theprobabilityisprettylow.Inthenextpartofthispost,IwilldemonstratesomemoreLombokannotations.ThesourcecodeforthispostcanbefoundhereonGitHub.LombokLombokannotationsShare4AboutSFGContributorStaffwriteraccountforSpringFrameworkGuruUsingProjectLombokwithGradleShouldIUseSpringRESTDocsorOpenAPI?YouMayAlsoLikeBootstrappingDatainSpringBootBySFGContributorSpring,SpringBootSeptember26,202110SchedulinginSpringBootBySFGContributorSpring,SpringBootSeptember6,202120SpringforApacheKafkaBySFGContributorSpring,SpringBootAugust11,202100SpringBootCLIBySFGContributorSpring,SpringBootJuly30,202150ActuatorinSpringBootBySFGContributorSpring,SpringBootJuly24,202120InternationalizationwithSpringBootBySFGContributorSpring,SpringBootJuly24,202110UsingDequeinJavaBySFGContributorJavaJuly1,202100EnumSetinJavaBySFGContributorJavaJune26,202100UsingImmutableListinJavaBySFGContributorJavaJune26,202100The@RequestBodyAnnotationBySFGContributorSpring,SpringBoot,SpringFramework5,SpringMVC,SpringRESTMay19,202100BeanValidationinSpringBootBySFGContributorSpring,SpringBoot,SpringMVCMarch25,202130ExceptionHandlinginSpringBootRESTAPIBySFGContributorSpring,SpringBoot,SpringMVCMarch22,202101ConvertOffsetDateTimetoSQLTimeStampBySFGContributorJavaMarch6,202110SpringRESTDocsBySFGContributorSpring,SpringBoot,SpringRESTFebruary19,202100ParameterizedTestsinJUnit5BySFGContributorJava,JUnit,TestingFebruary10,202100UsingMapStructwithProjectLombokByjtJava,Lombok,SpringFebruary5,2021111ArgumentCaptorinMockitoBySFGContributorJava,Mockito,Spring,TestingFebruary2,202120ReadingExternalConfigurationPropertiesinSpringBySFGContributorSpringBoot,SpringFramework5January30,202151CommonListOperationsBySFGContributorJavaDecember4,202000APIGatewaywithSpringCloudBySFGContributorSpring,SpringBoot,SpringCloudNovember27,202001UsingRecordsinJavaBySFGContributorJavaNovember20,202020TestingSpringBootRESTfulServicesBySFGContributorJUnit,Spring,SpringBoot,SpringFramework5,SpringTest,TestingNovember19,20203CachinginSpringRESTfulService:Part2–CacheEvictionBySFGContributorSpring,SpringBootNovember19,202000SpringBootMessagingwithRabbitMQBySFGContributorSpringBootNovember18,202032ComparisonandSortingwithLambdaBySFGContributorJavaNovember18,202000CachinginSpringBootRESTfulService:Part1BySFGContributorSpring,SpringBootOctober30,202010TheNewSwitchCaseFeaturesBySFGContributorJavaOctober23,202000ImmutablePropertyBindingBySFGContributorJava,Spring,SpringBootSeptember10,202030JavaBeanPropertiesBindingBySFGContributorJava,Spring,SpringBootSeptember10,202011ExternalConfigurationDatainSpringBySFGContributorSpring,SpringBoot,SpringFramework5July30,202062ConvertOffsetDateTimetoLocalDateTimeBySFGContributorJavaJuly22,202011SpringDataJPA@QueryBySFGContributorSpring,SpringBoot,SpringData,UncategorizedJuly22,202062ConvertOffsetDateTimetoZonedDateTimeBySFGContributorJava,UncategorizedJuly5,202020Fabric8DockerMavenPluginBySFGContributorDocker,SpringBoot,UncategorizedJune13,202000FeignRESTClientforSpringApplicationBySFGContributorGradle,IntelliJ,Java,Lombok,Spring,SpringCloudJune7,202002DockerHubforSpringBootBySFGContributorDocker,SpringBootMay30,202041ConsulMiniseries:SpringBootApplicationandConsulIntegrationPart3BySFGContributorConsul,SpringBootMay27,202000RunSpringBootonDockerBySFGContributorDocker,SpringBootMay24,202000UsingjEnvforSettingtheJAVA_HOMEPathBySFGContributorJavaMay19,202001ConsulMiniseries:SpringBootApplicationandConsulIntegrationPart2BySFGContributorConsul,Docker,Gradle,IntelliJ,Java,Lombok,Spring,SpringBoot,SpringCloud,SpringMVCMay18,202031ConsulMiniseries:SpringBootApplicationandConsulIntegrationPart1BySFGContributorConsul,Docker,Gradle,Java,Lombok,Spring,SpringBootMay18,202015Java14recordsBySFGContributorGradle,IntelliJ,JavaMay18,202000WhyYouShouldbeUsingSpringBootDockerLayersByjtDocker,SpringBootMay18,202084SpringBeanScopesBySFGContributorSpring,SpringBoot,SpringFramework5April23,202051UsingSDKMANforYourDevelopmentEnvironmentBySFGContributorJavaApril15,202000DebugyourCodeinIntelliJIDEABySFGContributorDebugging,IntelliJ,Java,Spring,SpringBootApril14,202040StayatHome,LearnfromHomewith6FreeOnlineCoursesByjtJava,SpringMarch26,202034WhatisthebestUItoUsewithSpringBoot?ByjtSpringBootJanuary3,202041ShouldIUseSpringRESTDocsorOpenAPI?ByjtSpring,SpringBoot,SpringCloudContract,SpringMVCNovember27,201961UsingProjectLombokwithGradleBySFGContributorGradle,Java,Spring,SpringBootSeptember2,201910SpringProfilesBySFGContributorSpring,SpringBoot,SpringCore,SpringFramework5August13,201921AutowiringInSpringBySFGContributorJava,Spring,SpringBoot,SpringCoreJune30,201940WhatisNewinSpringBoot2.2?BySFGContributorSpring,SpringBootJune20,201900UsingEhcache3inSpringBootByDanielWagnerSpringBootJune11,2019156HowtoConfigureMultipleDataSourcesinaSpringBootApplicationBySFGContributorSpringBoot,SpringDataMay31,20192025UsingRestTemplatewithApachesHttpClientByDanielWagnerSpringBoot,SpringFramework5,SpringIntegrationMay30,2019154UsingRestTemplateinSpringByDanielWagnerSpring,SpringBoot,SpringIntegrationMay30,2019102ServiceLocatorPatterninSpringBySFGContributorJava,Spring,SpringBootMay22,2019107UsingGraphQLinaSpringBootApplicationBySFGContributorGraphQL,Spring,SpringBootMay21,2019711SpringJdbcTemplateCRUDOperationsByDanielWagnerJava,Spring,SpringBootMay20,201980JavaArrayListvsLinkedListBySFGContributorJavaMay10,201901JavaTimerBySFGContributorJavaMay10,201910JavaHashMapvsHashtableBySFGContributorJavaMay10,201900SortingJavaCollectionsByHarrisonBrockJavaFebruary14,201921IteratingOverCollectionsInJavaByHarrisonBrockJavaFebruary6,201902IsStringAPalindrome?ByHarrisonBrockJavaFebruary1,201902UsingSDKMANToManageJavaVersionsByHarrisonBrockJavaJanuary31,201920InstallingMavenByjtJavaDecember6,201800MergeSortinJavaByjtJavaNovember20,201820WhyYourJUnit5TestsAreNotRunningUnderMavenByjtJava,JUnitNovember17,201848Spring5WebClientByjtReactiveStreams,SpringBoot,SpringFramework5November13,201854ConvertingbetweenJavaListandArrayByjtJavaMay27,201840UsingJavaEnumsByjtJavaApril25,201830ConvertingJavaMaptoListByjtJavaApril20,201814JavaStringtoIntByjtJavaApril20,201810UsingJAXBforXMLwithJavaByjtJavaJanuary24,20181010Java8forEachByjtJavaJanuary16,2018124JacksonMix-inAnnotationByjtJavaJanuary11,201865SpringComponentScanByjtSpring,SpringBoot,SpringMVCNovember30,2017174EnablePrettyPrintofJSONwithJacksonByjtJavaNovember29,201701RandomNumberGenerationinJavaByjtJavaNovember29,201700JacksonAnnotationsforJSONByjtJavaNovember29,201763GoogleGSONforJSONProcessingByjtJavaSeptember23,201731UsingCircleCItoBuildSpringBootMicroservicesByjtSpring,SpringBootSeptember20,201731UsingJdbcTemplatewithSpringBootandThymeleafByMichaelGoodSpring,SpringBootSeptember17,201746SpringBootwithEmbeddedMongoDBByjtSpring,SpringBootJuly31,201717SpringBootRESTfulAPIDocumentationwithSwagger2ByjtSpringBootFebruary28,20172659MockitoMockvsSpyinSpringBootTestsByjtJUnit,SpringMVC,TestingFebruary25,201722ConfiguringSpringBootforMariaDBByjtSpringBootFebruary6,201753SpringBootWebApplication,Part6–SpringSecuritywithDAOAuthenticationProviderByjtSpring,SpringBoot,SpringData,SpringMVC,springsecurityFebruary6,2017248ConfiguringSpringBootforMongoDBByjtSpring,SpringBootFebruary6,2017416SpringBootWebApplication,Part5–SpringSecurityByjtSpring,SpringBoot,SpringMVC,springsecurityJanuary9,2017313ChuckNorrisforSpringBootActuatorByjtSpring,SpringBootDecember31,201600TestingSpringMVCwithSpringBoot1.4:Part1ByjtSpringBoot,SpringMVC,TestingDecember13,201677RunningSpringBootinADockerContainerByjtJava,SpringBootJune6,2016523ProcessingJSONwithJacksonByjtJavaMay21,201667JacksonDependencyIssueinSpringBootwithMavenBuildByjtJava,SpringBootMay18,20161110UsingYAMLinSpringBoottoConfigureLogbackByjtJava,Logback,SpringBootMay5,2016711UsingLogbackwithSpringBootByjtJava,Logback,SpringBootApril29,20166226LogbackConfiguration:UsingGroovyByjtGroovy,Java,LogbackApril19,201603LogbackConfiguration:UsingXMLByjtJava,LogbackApril17,201626IteratingJavaMapEntriesByjtJavaApril15,201613LogbackIntroduction:AnEnterpriseLoggingFrameworkByjtLogbackApril8,201658UsingLog4J2withSpringBootByjtJava,Log4J2,SpringBootApril7,2016813AsynchronousLoggingwithLog4J2ByjtJava,Log4J2March31,201623Log4J2Configuration:UsingYAMLByjtJava,Log4J2March26,201626Log4J2Configuration:UsingJSONByjtJava,Log4J2March23,201603Log4J2Configuration:UsingXMLByjtJava,Log4J2March10,201605Log4J2Configuration:UsingPropertiesFileByjtJava,Log4J2March8,2016435HibernatePagination–HowToByjtJavaFebruary24,2016911IntroducingLog4J2–EnterpriseClassLoggingByjtJava,Log4J2February8,201659WhyIuseIntelliJByjtJavaJanuary17,201600SamyismyHeroandHackingtheMagicofSpringBootByjtSpring,SpringBootJanuary13,201610JavaLanguage#1inJanuary2016ByjtJavaJanuary6,201612ConfiguringSpringBootforPostgreSQLByjtSpringBoot,UncategorizedDecember30,201578EmbeddedJPAEntitiesUnderSpringBootandHibernateNamingByjtSpring,SpringBoot,SpringDataDecember15,201561SpringBootDeveloperToolsByjtSpringBootNovember21,201539SortingJavaArrayListByjtJavaOctober29,201543GettingCurrentDateTimeinJavaByjtJavaOctober16,201500UsingH2andOraclewithSpringBootByjtSpring,SpringBootSeptember30,2015211ConfiguringSpringBootforOracleByjtSpringBootSeptember11,20151621SpringBootWebApplication–Part4–SpringMVCByjtSpring,SpringBoot,SpringData,SpringMVCSeptember10,20155967ConfiguringSpringBootforMySQLByjtSpringBootAugust26,2015218MockinginUnitTestswithMockitoByjtJava,JUnit,TestingAugust21,20151217SpringBootExampleofSpringIntegrationandActiveMQByjtSpringBoot,SpringIntegrationAugust18,2015412YouShouldUseJAXBGeneratedClassesforRestfulWebServicesByjtJavaAugust7,201506UnitTestingwithJUnit–Part4–ParameterizedandTheoriesByjtJava,JUnit,TestingJuly21,201511UnitTestingwithJUnit–Part3–HamcrestMatchersByjtJava,JUnit,TestingJuly5,201522UnitTestingwithJUnit–Part2ByjtJava,JUnit,TestingJune30,201505SpringBootWebApplication–Part3–SpringDataJPAByjtJUnit,SpringBoot,SpringDataJune25,2015274SpringBootWebApplication–Part2–UsingThymeLeafByjtSpringBootJune25,20154343SpringBootWebApplication–Part1–SpringInitializrByjtSpringBootJune25,2015215UnitTestingwithJUnit–Part1ByjtJava,JUnit,TestingJune23,201519UsingtheH2DatabaseConsoleinSpringBootwithSpringSecurityByjtSpring,SpringBoot,springsecurityJune17,20155743RunningCodeonSpringBootStartupByjtSpring,SpringBoot,SpringCoreJune12,201537IntegrationTestingwithSpringandJUnitByjtJUnit,SpringJune8,201526TestingSoftwareByjtJUnit,Testing,UncategorizedMay13,201546MonetaryCalculationPitfallsByjtJavaMay10,201510PolymorphisminJavaByjtJavaMarch29,201513IntroductiontoJavaVariablesByjtJavaMarch28,201501HelloWorldWithSpring4ByjtJava,Spring,SpringCoreMarch11,201510GettingStartedWithSpringBootByjtJava,SpringFebruary23,201523What’sallthefussaboutJavaLambdas?ByjtJava,SpringFebruary5,2015002commentson“SpringBootwithLombok:Part1”JayJuly26,2020at11:18amI’vebeenusingLombokfromlast5-months.However,Ididn’tnoticeanyissues.couldyoupleaseelaboratemoreon–”LombokinternallyusestheannotationprocessorAPIastheentrypoint.ThisAPIonlyallowsthecreationofnewfilesduringthecompilationandnotthemodificationoftheexistingfiles.”ReplyjosepazSeptember22,2020at4:01pmverycooltutorial,IhaveitnowrunningandIbelievethiswillsavememillionsofkeystrokes.Ibelievemyclassesareverymuchreadable.Lovedthe@Slf4jannotationfoundontheirwebsite.ReplyLeaveaReplyCancelReplyYouremailaddresswillnotbepublished.Requiredfieldsaremarked*CommentName*Email*WebsiteSavemyname,email,andwebsiteinthisbrowserforthenexttimeIcomment.ThissiteusesAkismettoreducespam.Learnhowyourcommentdataisprocessed.FreeIntrotoSpringBootOnlineCourseSpringBootOnlineCourseSpringSecurityCoreOnlineCourseTestingSpringBootTutorialRecentPostsGettingReadyforSpringFramework6February5,2022BootstrappingDatainSpringBootSeptember26,2021SchedulinginSpringBootSeptember6,2021SpringforApacheKafkaAugust11,2021SpringRetryJuly30,2021



請為這篇文章評分?