Posts

Showing posts from 2016

Spring Boot and Thymeleaf: Reload templates and static resources without restarting the application

Thymeleaf was designed around the concept of Natural Templates that allows static prototyping: template logic doesn’t affect the template from being used as prototype. Although this is a great technique, you may also want to see the results in a running Spring Boot application and without restarting the server each time you change Thymeleaf view. In addition, you may expect that all other static resources like JavaScript and CSS files can be reloaded during development also. How to achieve it with Spring Boot?

Angular2 Typescript Webpack Quickstart

Get started quickly with Angular2 Typescript and Webpack: A skeleton / seed Angular2 application that was created by following the official WEBPACK: AN INTRODUCTION on angular.io . I have built this small seed project to get better understanding of the Webpack mechanics as I have never worked with this tool before. I suggest reading the original article, but if you look to start quickly you can use the code and start your own seed project immediately.

Spring MVC Archetype updated - Spring 4.3.2 introduced

For all those developers interested in bootstrapping Spring 4 application quickly without Spring Boot, please check my Spring MVC 4 Quickstart Maven Archetype that just got updated: Spring 4.3.2, Thymeleaf 3.0.1 among others.

Injecting authenticated user into Spring MVC @Controllers

Injecting injecting authenticated user into Spring MVC handler method can be done with @AuthenticationPrincipal annotation and AuthenticationPrincipalArgumentResolver that is an implementation of Spring MVS MethodArgumentResolver . AuthenticationPrincipalArgumentResolver is registered by default with web security configuration (e.g. when you enable security with @EnableWebSecurity ).

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

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.

Spring MVC: Trgger manual validation of a form object

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 in order to verify the existance in e.g. database. public class User { @UserExists private String username; } In controller class I have a method that handles POST method of that object: @Autowired private org.springframework.validation.Validator validator; @RequestMapping(value = "/user", method = RequestMethod.POST) public String validate(@ModelAttribute User user, Errors errors) { ValidationUtils.invokeValidator(validator, user, errors); if (errors.hasErrors()) { // error, show errors to the user } // success, form is valid! } org.springframework.validatio...

Quickstart: Angular2 with TypeScript and Gulp: Watch For File Changes

In this part of Quickstart: Angular2 with Typescript and Gulp I will walk you through adding watch task to angular2-typescript-gulp project so changes in source directory are reflected in the build directory.

Quickstart: Angular2 with TypeScript and Gulp: TSLint

In this part of Quickstart: Angular2 with Typescript and Gulp I will walk you through adding TypeScript Lint to angular2-typescript-gulp project. TSLint checks TypeScript code for readability, maintainability, and functionality errors and in Gulp it can be used with gulp-tslint plugin.

Quickstart: Angular2 with TypeScript and Gulp

Image
Angular2 is out. The new version of the framework is much simpler to learn thanks to easier and more concise concepts like component-based architecture, new dependency injection or built-in modularity. In this step-by-step tutorial you will learn how how to get started with Angular2 with TypeScript and Gulp. Source code available on Github.

Skip SSL certificate verification in Spring Rest Template

How to skip SSL certificate verification while using Spring Rest Template? Configure Rest Template so it uses Http Client to create requests.

Spring MVC 4 Quickstart Maven Archetype Improved - More Java 8 Features

For all those developers interested in bootstrapping Spring 4 application quickly without Spring Boot, please check my Spring MVC 4 Quickstart Maven Archetype that just got updated. Archetype uses Java 8 as target platform for some time already but no specific Java 8 features were supported. Recent changes bring (apart from some bug fixing) support for Java 8 Data & Time API in Thymeleaf, Jackson and JPA.

Generate direct link to Google Drive image

Image
If you want to create a direct link to a public image on Google Drive you may use Permanent link generator that I crated for my personal use.