Monday, October 24, 2016

Spring things

Yes I know Spring got easier nowadays. Once upon a time I looked at the Spring Tools Suite (STS). Omg Spring has so many things (See the Projects page). Here is one thing that may deserve your attention: Spring Boot.

Once upon a time there is a guy leaving the computer and I ask hey how to build-compile-your-code-over-here. And it turns out to be a Spring Boot app and gosh I never even heard of this. So this is a as-quick-as-you-can Spring application. You don't need to create a WAR file and deploy on an app server like tomcat! It is all built in. (No more fool around with creating a blank app (that itself is hard to do without an IDE like eclipse, fool around with the servlet mapping, hijack it... make your classes with all sorts of odd annotations, fight maven dependencies to make war and then deploy).

I admire those who put tutorials on the web. I admire those who put entire project source code even more. I am able to get a great Spring Boot app running from https://springframework.guru/spring-boot-web-application-part-1-spring-initializr/. Great stuff. Even has a database hooked up for you with CRUD operations. It would take many hours to do if you have to do this by hand.

Now, the world likes APIs. If you do web apps, most likely you write your API with java to have your front end call by AJAX... and API gets messy and undocumented. Especially when you have sloppy or smart-but-sloppy colleagues who never comments anything. Every API call ought to be documented unless it is obvious what it does.

http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api is pretty helpful. (Although I hope there is a entirely downloadable thing here too). Swagger is pretty awesome... It generates javadoc-like things on the fly for you and you can even try your API right there on the swagger-ui.html.

So now I have a Spring Boot thing ready for new MVC project, ready with API documentation.

Thanks to awesome helpful people who put examples out.

No comments: