Home » Author Archives: Rafal Borowiec

Author Archives: Rafal Borowiec

Software developer, Team Leader, Agile practitioner, occasional blogger, lecturer. Open Source enthusiast, quality oriented and open-minded.

Thymeleaf 3 – Get Started Quickly with Thymeleaf 3 and Spring MVC

spring-interview-questions-answers

Thymeleaf 3 release arrived. The new version brings plenty of new features like HTML5 support as well as Text templates support with no markup – [# th:utext="${thymeleaf.version}" /] , improved inline capabilities – <p>Thymeleaf [[${thymeleaf.version}]] is great!</p>, performence improvements and much more. The easiest way the get starter with Thymeleaf 3 and Spring MVC is by using Spring MVC 4 ...

Read More »

Spring MVC: Trgger manual validation of a form object

spring-interview-questions-answers

Sometimes it may be needed to use manual validation in Spring MVC @Controller. This is very simple with Spring’s org.springframework.validation.ValidationUtils class. Learn how to invoke a validator in two different scenarios.             Scenario 1 – invoke validation In this scenario, I have a user form with username field. Username field is validated with custom validator ...

Read More »

Skip SSL certificate verification in Spring Rest Template

spring-interview-questions-answers

How to skip SSL certificate verification while using Spring Rest Template? Configure Rest Template so it uses Http Client to create requests. Note: If you are familiar with sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target the below should help you. Http Client Firstly, import HttpClient (>4.4), to your project compile('org.apache.httpcomponents:httpclient:4.5.1') Configure RestTemplate Configure SSLContext using Http Client’s ...

Read More »

HOW-TO: Register components using @Conditional and Condition in Spring

spring-interview-questions-answers

@Profile annotation in Spring can be used on any Spring components (e.g. @Component, @Service, @Configuration etc.) that are candidates for auto-detection. @Profile annotation accepts a single profile or a set of profiles that must be active in order to make the annotated component eligible for auto-detection. For a given @Profile({"p1", "!p2"}), registration will occur if profile p1 is active or ...

Read More »

HOW-TO: Java 8 Date & Time with Thymeleaf and Spring Boot

spring-interview-questions-answers

If you happen to work with Spring Boot and Thymeleaf and you need to format Java 8 Date & Time objects in your views you may utilize thymeleaf-extras-java8time – Thymeleaf module for Java 8 Date & Time API. Adding thymeleaf-extras-java8time to an existing Maven or Gradle based Spring Boot project is as easy as adding a dependency and registering new ...

Read More »

Placeholders support in Value annotations in Spring

spring-interview-questions-answers

${...} placeholders in @Value annotation are used to access properties registered with @PropertySource. This is extremely useful with @Configuration beans in Spring applications, but not only. To be sure that this is possible, PropertySourcesPlaceholderConfigurer must be present in all application contexts that placeholders resolution is required. In this blog post you will learn how to configure placeholders resolution in Spring ...

Read More »

AssertJ’s SoftAssertions – do we need them?

java-logo

One of the rules of writing good unit test is that it should fail for one reason, so unit test should test one logical concept. Sometime it is quite tough to have a single assertion per test. To follow the rule, we may have having multiple assertions per object in a single test. The problem with multiple assertions in a ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Advanced Java Guide
  • Java Design Patterns
  • JMeter Tutorial
  • Java 8 Features Tutorial
  • JUnit Tutorial
  • JSF Programming Cookbook
  • Java Concurrency Essentials