Spring Lemon
Note: for latest patterns and best practices, follow the successor https://github.com/naturalprogrammer/np-spring-mvc-demo
When developing real-world Spring REST APIs and microservices, you face many challenges like
- How to follow a stateless and efficient security model – using JWT 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 elegantly do validations and exceptions and send precise errors to the client.
- How to easily mix manual and bean validations in a single validation cycle.
- 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.
- How to correctly and effeciently secure microservices, using long-lived and short-lived JWTs.
- 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.
- How to do all the above reactively, using WebFlux and WebFlux security.
Coding all this rightly 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 comes out.
Spring Lemon relieves you of all this burden. It's a set of configurable and extensible libraries, providing all above features. Use these to develop quality reactive or non-reactive monolith or microservices applications quickly and easily.
Even if you don't plan to use Spring Lemon, it's a good example to learn from, because it showcases the essential best practices for developing elegant web services and microservices 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!
Read this quick starter guide or watch this video tutorial for getting started.
Libraries hierarchy
- spring-lemon-exceptions: Useful for elegant exception handling and validation in any Spring project
- spring-lemon-commons: Common for all things below
- spring-lemon-commons-web: For developing Spring Web (non-reactive) microservices
- spring-lemon-commons-jpa: For developing Spring Web (non-reactive) JPA microservices
- spring-lemon-jpa: For developing Spring Web (non-reactive) JPA monolith or auth-microservice
- spring-lemon-commons-jpa: For developing Spring Web (non-reactive) JPA microservices
- spring-lemon-commons-reactive: For developing Spring WebFlux (reactive) microservices
- spring-lemon-commons-mongo: For developing Spring WebFlux (reactive) MongoDB microservices
- spring-lemon-reactive: For developing Spring WebFlux (reactive) MongoDB monolith or auth-microservice
- spring-lemon-commons-mongo: For developing Spring WebFlux (reactive) MongoDB microservices
- spring-lemon-commons-web: For developing Spring Web (non-reactive) microservices
- spring-lemon-commons: Common for all things below
For example usages, see
- Demo non-reactive monolith
- Demo reactive monolith
- Demo non-reactive microservices and its configuration repository
- Demo reactive microservices and its configuration repository
Documentation and Resources
Our Spring Framework Recipes For Real World Application Development — a live book discussing key real-world topics on developing Spring applications and APIs — is now available for FREE. Click here to get it.
- Feature demo: https://youtu.be/6mNg-Feq8CY
- Getting started guide
- Official Documentation
- Example applications
- API documentation of the above applications.
- Example AngularJS front-end application — A sample AngularJS 1.x front-end. It'll work for the application developed in the above getting started guide as well all the above example applications. See the Getting Started Guide on how to use it.
- Spring Framework Recipes For Real World Application Development — a live book discussing key real-world topics on developing Spring applications, APIs and microservoces. Includes many Spring Lemon topics. Click here to get it now for FREE!
- Using Spring Lemon Effectively
- DZone Articles
- Video tutorials coming soon:
- Spring Framework 5 REST API Development — A Complete Blueprint For Real-World Developers
- Spring WebFlux Reactive REST API Development — A Complete Blueprint For Real-World Developers
- Microservices Using Spring Cloud — A Rapid Course For Real World Developers
- Join here to get notified and avail heavy discounts when the above courses get released
Help and Support
- 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.
Releases and Breaking Changes
- See here.