728x90 분류 전체보기970 Lombok features - @Getter and @Setter Never write public int getFoo() {return foo;} again. Overview You can annotate any field with @Getter and/or @Setter, to let lombok generate the default getter/setter automatically. A default getter simply returns the field, and is named getFoo if the field is called foo (or isFoo if the field's type is boolean). A default setter is named setFoo if the field is called foo, returns void, and take.. 2020. 12. 21. Lombok features - @Cleanup @Cleanup Automatic resource management: Call your close() methods safely with no hassle. Overview You can use @Cleanup to ensure a given resource is automatically cleaned up before the code execution path exits your current scope. You do this by annotating any local variable declaration with the @Cleanup annotation like so: @Cleanup InputStream in = new FileInputStream("some/file"); As a result,.. 2020. 12. 9. Lombok features - @NonNull @NonNull or: How I learned to stop worrying and love the NullPointerException. @NonNull was introduced in lombok v0.11.10. Overview You can use @NonNull on the parameter of a method or constructor to have lombok generate a null-check statement for you. Lombok has always treated various annotations generally named @NonNull on a field as a signal to generate a null-check if lombok generates an ent.. 2020. 12. 9. Lombok features - val & var val Finally! Hassle-free final local variables. val was introduced in lombok 0.10. Overview You can use val as the type of a local variable declaration instead of actually writing the type. When you do this, the type will be inferred from the initializer expression. The local variable will also be made final. This feature works on local variables and on foreach loops only, not on fields. The ini.. 2020. 12. 9. Spring Boot file uploader Follow these five steps to use Spring Boot to upload files from the client to the server: Create a Spring Boot application and include the Spring Web facilities; Create a Spring @Controller class; Add a method to the controller class which takes Spring’s MultipartFile as an argument; Save the uploaded file to a directory on the server; and Send a response code to the client indicating the Spring.. 2020. 11. 26. How to embed Tomcat and Java web apps in an executable JAR Historically, we packaged production-ready Java web apps as WAR files. A servlet engine, like an IBM WebSphere or Apache Tomcat server, would host multiple applications at once. But for a variety of reasons -- the widespread adoption of microservices and desire to perform highly isolated unit tests, for instance -- the one-to-many relationship between the Java web app and the .. 2018. 5. 29. 이전 1 ··· 105 106 107 108 109 110 111 ··· 162 다음 728x90