When developing real-world Spring REST services for JavaScript web applications, mobile clients or any consumer, you face many challenges, such as
- How to make the API truly stateless, using token authentication, session sliding etc.
- How to configure Spring Security to suit API development, e.g. returning 200 or 401 responses on login, configuring CORS, JSON vulnerability protection, etc.
- How to handle validations and exceptions in a cross functional manner and send precise errors to the client.
- How exactly to support multiple social sign up/in, using OpenID Connect or OAuth2 providers such as Google and Facebook.
- How to code a robust user module (with features like sign up, sign in, verify email, social sign up/in, update profile, forgot password, change password, change email, token authentication etc.) and share it across all your applications.
- What would be good ways to test your API.
- How to do Captcha validation.
- How to properly organize application properties.
- How to use PATCH and JsonPatch to handle partial updates correctly.
Coding all the above effectively needs in-depth knowledge of Spring. It also takes a lot of development time and effort, and needs to be properly maintained as new versions of Spring modules come out.
To relieve you of this non-trivial job, we thought to bring out Spring Lemon, a tiny open source library holding all these common configuration and components, and a production grade user module with all the abovementioned features.
Even if you don't plan to use Spring Lemon, it's a good example application to learn from, because it showcases the essential best practices for developing elegant web services using Spring.
Most Spring Boot applications can use Spring Lemon straight away, with some simple configurations. But, if you don't find it suitable for your application, feel free to fork it, or just roll out your own library by learning its patterns and practices. Better yet, be a contributor!
Watch this video tutorial or read this quick starter guide for getting started.
Part I of our video tutorial Mastering Spring RESTful Web Services Development -- the ultimate course to master REST API development using Spring, whether you use Spring Lemon or not -- now available for pre-order for FREE!
- Feature demo: https://youtu.be/6mNg-Feq8CY
- Getting started guide
- Example application - A sample application using Spring Lemon. Quite similar to the one developed in the above getting started guide, but additionally has automated tests.
- API documentation of the above application.
- Spring Lemon JavaDoc
- Example Angular 1.x front-end application - A sample AngularJS 1.x front-end. It'll work both for the application developed in the above getting started guide as well as the Lemon Demo application.
- Mastering Spring RESTful Web Services Development - Ultimate video tutorial to master REST API development using Spring. Also covers Spring Lemon in depth. A must guide if you want to become an expert Spring developer, whether you use Spring Lemon or not. Pre-order its part I now for FREE!
- Community help is available at stackoverflow.com, under the
spring-lemon
tag. Do not miss to tag the questions withspring-lemon
! - Submit an issue for any bug or enhancement. Please check first that the issue isn't already reported earlier.
- Mentoring, training and professional help is provided by naturalprogrammer.com.
Like Spring Lemon? We have been putting continuous efforts to develop and maintain it. If it's being useful to you, why not donate a little amount — it’ll help us give more time to the project!
Click here to donate.
- See here.