In this post we will be developing a full-blown CRUD application using Spring Boot, AngularJS, Spring Data, JPA/Hibernate and MySQL, learning the concepts in details along the way. This application can as well serve as a base/starting point for your own application. In addition, we will also use the notion of profiles to deploy the…
Continue readingSpring Boot Rest API Example
Spring Boot complements Spring REST support by providing default dependencies/converters out of the box. Writing RESTful services in Spring Boot is no-different than Spring MVC. If you are a REST Client [Rest Consumer], Spring Boot provides RestTemplateBuilder that can be used to customize the RestTemplate before calling the REST endpoints. To summarize, Spring Boot based…
Continue readingSpring Boot WAR deployment example
Being able to start the application as standalone jar is great, but sometimes it might not be possible to run an app as jar [environment restrictions, company-wide regulations etc] and you have to build a WAR to be deployed into a traditional web/application server. Spring Boot helps us creating WAR using SpringBootServletInitializer. Following technologies stack…
Continue readingSpring Boot Introduction + hello world example
Spring framework has taken the software development industry by storm. Dependency Injection, rock solid MVC framework, Transaction management, messaging support, web-services etc are some of the aspects spring provides through its eco-system of related sub-frameworks. Convention over configuration is the most prominent key aspect Spring promotes. Spring-Boot which is build upon Spring foundation itself, takes…
Continue readingSecure Spring REST API using OAuth2
Let’s secure our Spring REST API using OAuth2 this time, a simple guide showing what is required to secure a REST API using Spring OAuth2. Our use-case fits well with Resource-owner Password Grant flow of OAUth2 specification. We will use two different clients [Postman and a Spring RestTemplate based java application] to access our OAuth2…
Continue readingAngularJS+Spring Security using Basic Authentication
This post shows how an AngularJS application can consume a REST API which is secured with Basic authentication using Spring Security. Post Secure Spring REST API with Basic Authentication shows in great details how to secure a REST API using Basic authentication with Spring Security. That application will serve as a Back-end for this example….
Continue readingSecure Spring REST API using Basic Authentication
So You’ve got the REST API for your application, and now you want to secure it. How to do that? There are several popular ways to do that, ranging from Basic Authentication to a full fledged OAuth2 security solution. This Guide explains securing REST API using Basic Authentication with help of examples involving two separate…
Continue readingSpring 4 Caching Annotations Tutorial
Wondering how to use Caching in your Spring App? Jump right in. This post goes over the caching in detail, explaining commonly used Spring Caching annotations with examples including @Cacheable, @CachePut, @CacheEvict, @Caching, @CacheConfig & @EnableCaching. Let’s get going. A full code example is present at the end of the chapter showing these annotations in…
Continue readingSpring 4 Cache Tutorial with EhCache
Caching is crucial for today’s high performance hungry applications. Adding Caching in your Spring based application is rather trivial. There are many caching solutions available in market today namely EhCache, Guava Cache, Caffeine Cache, OScache, JBoss Cache,etc. Spring provides seamless integration with these caching solution using minimal configuration. Post Spring 4 Caching Annotations Tutorial contains…
Continue readingSpring 4 MVC+JPA2+Hibernate Many-to-many-Example
In this post, we will discuss about JPA2 with Spring and create a full JPA2 complaint persistence layer for our Spring 4 MVC based web application, showing Many-to-many association relationship, right from view till persistence. That means you can choose appropriate JPA2 provider [Hibernate, EclipseLink,..] and later switch between them with only minor configuration changes….
Continue reading