Learn to create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework, and add role based security using JAX-RS annotations e.g. @PermitAll, @RolesAllowed or @DenyAll. Table of Contents Project Structure Create REST APIs Secure REST APIs with JAX-RS Annotations Write security filter using JAX-RS ContainerRequestFilter Demo Project Structure The project structure of application created […]
Learn to configure and create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework. This example application uses Jersey’s ServletContainer to deploy the REST APIs.
Learn to configure Spring boot application with embedded ActiveMQ for sending and receiving JMS messages with help of JMSTemplate.
PropertyEditor is originally part of the JavaBeans specification. Spring also heavily uses the PropertyEditors to be able to represent properties in a different way than the object itself e.g. parsing human readable inputs from http request params or displaying human readable values of pure java objects in view layer. Spring has a number of built-in […]
To schedule job in spring boot application to run periodically, spring boot provides @EnableScheduling and @Scheduled annotations. Lets learn to use them. Let’s say you want to run job at every 10 seconds interval. You can achieve this job scheduling in below steps: 1) @EnableScheduling to Spring Boot Application class Add @EnableScheduling annotation to your […]
Spring boot’s CommandLineRunner interface is used to run a code block only once in application’s lifetime – after application is initialized. How to use CommandLineRunner You can use CommandLineRunner interface in three ways: 1) Using @Component over CommandLineRunner implementation class This one is fairly easy. 2) Implement CommandLineRunner in SpringBootWebApplication itself This is also possible. […]
Spring boot loads lots of beans internally to run your application with minimal configuration. In this example, we will learn to find out all those spring boot loaded beans and their class type information. Using ApplicationContext to get all loaded beans To execute a method automatically, when application is fully loaded, I am using CommandLineRunner […]
Learn spring boot logging configuration via application.yml file in simple and easy to follow instructions. In the default structure of a Spring Boot web application, you can locate the application.yml file under the resources folder. Table of Contents Understand default spring boot logging Set logging level Set logging pattern Set logging output to file Using […]
Learn spring boot logging configuration via application.properties file in simple and easy to follow instructions. In the default structure of a Spring Boot web application, you can locate the application.properties file under the resources folder. Table of Contents Understand default spring boot logging Set logging level Set logging pattern Set logging output to file Using […]
By default, Spring boot uses embedded tomcat server to run the application. At times, you may need to use jetty server in place of tomcat server. Spring Boot provides Tomcat and Jetty dependencies bundled together as separate starters to help make this process as easy as possible. You can use jetty with following simple steps. […]