Skip to main content

Posts

LetsEncrypt - Free Open Certificate Authority

Have you ever noticed a green https:// near the website address name on the browsers? If you had noticed, you are luckily aware of the internet website security. https is a secure protocol version of http while http is hyper text transfer protocol to view web documents across internet. The https is enabled through obtaining a web security certificate from Certificate Authority(CA). The certificate authority is the one who verifies and validates your website and ensures the website is what it claims to be. There are many types of validations, namely, Domain Validation, Extended Validation etc. Some CAs provide wildcard certificates, i.e one certificate is enough to secure the web domain and all of its subdomains. For your information, All financial websites, banking sites use https protocol in order to protect customer information and avoid man in the middle attacks. They obtain https certificate from different CAs, mostly high expensive certificate providers. Ok. So, I
Recent posts

How to remove a file from GIT history

GIT, a source code management tool is famous among developers. Often times, developers miss to realise or understand .gitignore file in GIT ( a most popular open source repository tool ). This file helps to avoid unrelated files getting into the project repository. As a newbie to GIT, developers miss to add .gitignore and hence we get to see unwanted files or binaries added in the project repository. This may sometimes lead to issues for other developers. So, how do we remove a file from GIT history that should not have been added in the first place? Git has numerous commands of which   git filter-branch  can help us in this scenario. For example:  .iml files are Intellij editor files that will be created for each module. Lets suppose a developer (newbie) added this .iml file in project repository unknowingly. An other developer imports project modules in his/her IntelliJ editor. Then the latter will see *.iml as modified file. But this should not have been consider

Disable Datasource Auto Configuration in Spring Boot

Today morning, We had an interesting situation. Our spring boot application which is configured to run on MySQL needs to be run on a system which does not have MySQL database installed. But we had to develop few UI modules alone. So we decided to go ahead but how do we disable MySQL database auto-configuration? Here is what we did . Spring Boot is an interesting framework that helps auto configure everything for you. In case you need to override any of the auto-configuration, all you need to do is to simply customize it. The auto-configuration backs away. In this typical scenario, we dont want to customize the auto-configuration, rather we want to disable it temporarily until we complete our UI modules. As soon as the system is ready or we find alternate systems, we can run the Application with full-blown schema. OK. so how did we disable the database auto configuration? We are using Spring Boot with JPA, Hibernate and FlywayDB migration tool. If this is going to be your boot

Bean Validation (JSR 303) using Hibernate Validator in Spring Boot

Bean Validation Bean validation has always been a tremendous effort in Java based Enterprise application development. Java Bean Validation (JSR 303) is the framework that defines how Java Beans should be validated. There are few validator APIs that support JSR 303. Hibernate validator is the most popular among them. It helps validate Java Beans using annotation and the beans can be validated at presentation layer, service and data access layer. Hibernate validator also offers custom validation, cross field validations. You can checkout the latest hibernate validator documentation for built-in validator annotations. Assumption       :  Spring Boot  (1.5.6) ,   Hibernate Validator ( 5.4.1.Final ),  Maven Projects Integrating Spring Boot & Hibernate Validator Spring Boot offers built-in starter dependency management for most of the frameworks and APIs available in Java Application Development. It has support for bean validation using hibernate validator API. The discussion fo

Spring Boot, Thymeleaf static resource refresh

Introduction Thymeleaf is a natural template engine that is often used in modern java-server-side applications that are running in web and standalone environments. Ease of natural templating gives the upperhand to pick Thymeleaf over other frameworks in Java Serverside application development. Spring provides support to thmyeleaf development. Spring boot has its own starter dependency for thymeleaf. While we develop thmyeleaf templates using spring boot applications, Front End Developers cannot see the changes that are made in the resources while the application is running. But the changes don't take effect in the browser until the application is reloaded or restarted. Solution We can solve this templating-resources-reloading without application restart. Spring boot uses properties in which we have to just disable the cache for Thymeleaf. Below are the steps to achieve these. Step 1:  Disable the cache by setting the spring.thymeleaf.cache = false in the application.prope

In-Place editing with X-Editable using Datatable plugin

Introduction In-place editing is a trending feature that can be seen in many latest web applications, a popular example would be trello.com where the editing data happens on the web page without any explicit forms or popups. Another such example I could point out is, thoughtplan.com. The in-place editing is very nice in such a way that editing data seems so natural and user friendly. To enable in-place editing, there are many free JQuery plugins available on the internet. We are discussing a very popular plugin called x-editable . Most of the time we use html tables to display data where in-place editing is enabled. Hence we need another plugin to elegantly display tables with enormous data. We use a famous JQuery plugin called datatable . Both of these plugins are used widely and free to use. Assumption      : Bootstrap 3, JQuery used Projects Integration In order to enable datatable features on any ordinary table found on web page, we should initialise datatable plugin for

Flyway Integration with Spring Boot

This post talks about how we integrated Flyway with Spring Boot and enjoyed the power of database migration seamlessly. If you have worked on Enterprise applications, data migration is really liability for your project. One wrong move, your data get lost during your production patch fixes or release updates. To mitigate such issues happening over manual migrations or even in-house programmatic data migration, we adopted Flyway, an open-source database migration tool that favors simplicity and convention over configuration. Luckily, Spring Boot naturally gels with Flyway. Flyway                : 4.2.0 Spring Boot      : 1.5.6.RELEASE Assumption      : Java, MySQL & Maven Used Projects Flyway Maven Dependency Flyway has Maven dependency that we need to specify in the pom.xml while we configure spring-boot-starter dependencies. This makes sure Spring Boot look for database migration scripts in the classpath. The default lookout path is src/main/resources/db/migration and the