- Java
- Spring Boot
- Spring Boot AOP
- Spring Boot RESTful
- Spring Boot Handler Exception
- Spring Boot Internationalization
- Spring Boot JPA
- Spring Boot Externalization
- Spring Boot Bootstrap
- Spring Boot Testing
- Spring Boot Validation
- Spring Boot Testing Validation
- Spring Boot Security
- Spring Boot Security using Database
- Spring Boot Rest Client
- Spring Boot Actuator
- Spring Boot JDBC Template
- Spring Boot Flyway
- Spring Boot Liquibase
- Spring Boot Logback
- Spring Boot Thymeleaf Layouts
- Spring Boot Swagger
- Spring Boot Oauth2 with Google
- Spring Boot Ehcache
- Spring Boot Appium Cucumber
- Spring Boot Parameters
- Spring Boot Profiles
- Spring Boot Retrofit2 Cucumber & Junit5
- Spring Boot Testing Web Layer
- Spring Boot Publishing an Artifactory Library
- Spring Webflux Basics
- Spring Webflux Server
- Spring Webflux Client
- Spring Webflux Security
- Spring Webflux Security Database
- Spring Webflux with Thymeleaf
- Spring Boot JMS
- Spring Webflux Cucumber
- Spring Boot WebClient
- Spring Boot WebClient Cucumber and Junit5
- Spring Webflux Multi-Module
- Spring Weblux Internationalization
- Spring Weblux Testing Web Layer
- Spring Boot Hazelcast
- Spring Boot JsonNode
- Spring Boot Server-sent Event
- Spring Boot Server-sent Event Client
- Spring Boot H2
- Spring Webflux URI Validator
- Spring Webflux Webclient Headers
- Spring Boot XML Schema
- Spring Webflux JAXB
- Spring Webflux Constructor Injection
- Spring Webflux WebSockets
- Android
- UX Development
- Parsing JSON with ajax
- Inquirer & Callback
- Mongoose
- Templating with Swig & Express
- WebdriverIO Getting Started
- Applitools Getting Started
- WebdriverIO Geolocation
- WebdriverIO with Cucumber Getting Started
- WebdriverIO Lighthouse
- Selenium Cucumber And TestNG
- Cypress Getting Started
- Cypress Applitools Integration
- Playwright Getting Started
- Playwright Applitools Integration
- Playwright Reports Deployment
- Refactoring
- Algorithms
- Best Practices
- Continuous Integration & Delivery
- Sysadmin
- Python
Spring Boot includes a number of additional features to help you monitor and manage your application. The spring-boot-actuator module provides all of Spring Boot’s production-ready features.
Let’s start creating a new Spring Boot project with web and actuator dependencies:
spring init --dependencies=web,actuator --language=groovy --build=gradle spring-boot-actuator This is the build.gradle file generated:
buildscript { ext { springBootVersion = '1.5.12.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'groovy' apply plugin: 'org.
[Read More]
Spring Boot Rest Client
This time I will show you how to consume a REST service using Spring Boot and a Groovy library based in HTTPBuilder RESTClient by jgritman.
Let’s start creating a new Spring Boot project with web dependencies:
spring init --dependencies=web --build=gradle --language=groovy spring-boot-rest-client Here is the complete build.gradle file generated:
buildscript { ext { springBootVersion = '1.5.12.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'groovy' apply plugin: 'org.
[Read More]
Spring Boot Security using Database
This post walks you through the process of creating a simple registration and login example with Spring Security using database. Please read this previous post before conitnue with this information. First we need to add Spring Data JPA dependency to the build.gradle
compile 'org.springframework.boot:spring-boot-starter-data-jpa' Then we need to change Spring security Java config class in order to add userDetailsService to implement database access functionality:
package com.jos.dem.springboot.security.config import org.springframework.beans.factory.annotation.Autowired import org.springframework.context.annotation.Configuration import org.
[Read More]
Spring Boot Security
Spring Security is a powerful and highly customizable authentication and access-control framework. This technical post will review how to integrate security into your Spring Boot project. NOTE: If you need to know what tools you need to have installed on your computer to create a Spring Boot basic project, please refer to my previous post: Spring Boot. Then, let’s create a new Spring Boot project with web, security and Lombok as dependencies:
[Read More]
Spring Boot Testing Validation
This time I will show you how create a unit testing using Spock, Spock is a testing and specification framework for Java and Groovy applications it is highly expressive and easy to use. First you need to add Spock dependency in your build.gradle
testCompile 'org.spockframework:spock-spring' This is the class we are going to test:
package com.jos.dem.vetlog.validator import org.springframework.validation.Validator import org.springframework.validation.Errors import org.springframework.stereotype.Component import org.springframework.beans.factory.annotation.Autowired import com.jos.dem.vetlog.service.LocaleService import com.jos.dem.vetlog.command.UserCommand @Component class UserValidator implements Validator { @Autowired LocaleService localeService @Override boolean supports(Class<?
[Read More]
Spring Boot Validation
Spring has a Validation interface that we can use to create custom object validation; if some errors occur in the validation process, it stores them in a BindingResult object so you can test for and retrieve validation errors. Let’s consider the following validator implementation:
package com.josdem.springboot.validation.validator; import com.josdem.springboot.validation.command.PersonCommand; import org.springframework.validation.Validator; import org.springframework.validation.Errors; import org.springframework.stereotype.Component; @Component public class PersonValidator implements Validator { private final String REGEX = "[0-9]+"; @Override public boolean supports(Class<?
[Read More]
Spring Boot Bootstrap
Boostrap was originally created by a designer and a developer at Twitter, Bootstrap has become one of the most popular front-end frameworks and open source projects in the world. In this technical post I will show you how to add Bootstrap to your Spring Boot project. In order to get the setup for this example, please refer my previous posts Spring Boot JPA and Spring Boot Externalization. First you need to add Bootstrap dependency to your project, the way you should do it is add it as a Bower plugin to your build.
[Read More]
Spring Boot Testing
We can test our application using Junit or Spock, and we will see both. Also you can make unit, integration and functional testing.
Integration testing Spring Boot provides a @SpringApplicationConfiguration annotation as an alternative to the standard @ContextConfiguration annotation.
package com.jos.dem.jmailer import static org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith import org.springframework.boot.test.SpringApplicationConfiguration import org.springframework.test.context.junit4.SpringJUnit4ClassRunner import org.springframework.beans.factory.annotation.Autowired import org.springframework.mail.javamail.JavaMailSenderImpl @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = JmailerApplication.class) class JmailerApplicationTests { @Autowired JavaMailSenderImpl javaMailSender @Test void shouldLoadContext() { assertEquals('smtp.
[Read More]
Spring Boot Externalization
In this example we are going to externalize MySQL database connection using a yaml file. In order to get the setup for this example, please refer my previous post Spring Boot JPA
First we need to create our yml file in ${USER_HOME}/.spring-boot-jpa/application-development.yaml
spring: datasource: url: jdbc:mysql://localhost/spring_boot_jpa username: username password: password driverClassName: com.mysql.jdbc.Driver jpa: generateDdl: true Next we need to add bootRun closure and specify a system properties in our build.gradle file
[Read More]
Spring Boot JPA
The key goal of Spring Data repository abstraction is to significantly reduce the amount of code required to implement data access layers for various persistence stores. In this example I will show you how to create a JPA repository to save and retrieve all Person model. NOTE: If you need to know what tools you need to have installed in yout computer in order to create a Spring Boot basic project, please refer my previous post: Spring Boot
[Read More]