Paul Sterl has written 20 articles

Spring Data MongoDB and JSR Validation using Lazy DBRef

The Problem Recently using MongoDB and Spring Data I encountered an interesting issue. Saving an Entity  which was loaded by @DBRef(lazy = true) wasn’t possible together with the activated ValidatingMongoEventListener. Each time the following error occurred:

The Issue Well looking into the details it is quite clear — as an dynamic proxy is passed to the validation which fields…

Android show Keyboard by default

Problem Sometimes we the Keyboard doesn’t show up by default if we e.g. open a dialog and request the focus for an input element. Even following the default tutorials doesn’t really help. As soo here some samples how it will show up. Solution Show Keyboard in Dialogs / DialogFragment Usually the solution the the Android…

Android Global Exception Handler

Background / Motivation Sometimes it is quite useful to handle / catch exceptions in a central handler. Typical samples are: Handle Authorization problems e.g. with your backend Central dispatching of these error to an Exception Collector like Crashlytics (ur just send an email) Just show a message dialog to the to the user Implementation Just…

Serialization Jackson vs Google Protocol Buffers

Where are many articles around comparing the serialization between different frameworks and of course different encodings. I came around recently the problem that I needed a very fast serialization for pretty simple objects but between different platforms (embedded device with C, Android Java, iOS Objective-C and Java Backend). Well first reaction, let us just take…

MariaDB and Spring Boot

Yaml Configuration

Important to notice hibernate.dialect must be set driver-class-name must be set it needs to be the MySQL5InnoDBDialect or MySQL57InnoDBDialect instead of the MySQLInnoDBDialect Dependencies in Maven

JavaScript Module Pattern or Just Private Variables

JavaScript is a wonderful language to get thinks fundamentally wrong from the start. As so where are many patters around to help us to avoid some of these challenges ;-). The module pattern is one of the mostly known and used. It helps us to create private variables or better to avoid side effects in…

Use Session and Request Scope Beans in Tests with Spring

Sometimes it is useful haven the Web Scopes in Unit Tests. Usually Spring just show this very useful error in the Unit Test:

You can easily have all needed web scopes in your unit test by adding the following annotation to your Tests: @WebAppConfiguration. Now Web Scopes like:

will work.  

Spring Boot Configuration – Properties not loaded

I had recently a very interesting problem using Spring Boot and the auto magic concerning the configuration. The Problem

Configuration was not available in my Unit tests but it was working fine in the normal application. I spend a lot of time searching but without real good post concerning this issue. This code already…

JSR 303 Validation for Dates

A common case is to validate date inputs in Java e.g. to avoid the nice and friendly typos like 06/01/1500. Nevertheless by default where is not to much support to handle this very common case. So let’s fix this together: Annotation first The first we need is a JSR annotation which we use to annotate…