JEE 7 Activiti integration

Overview To enable activiti in our JEE project the following steps are needed: Add the maven dependencies — include spring-context Add log4j configuration Add the activiti configuration for CDI integration activiti.cfg.xml Add your first activiti workflow Add a activiti compatible data source to your container Deploy an run it Git Project. Eclipse Plugin To install the…

JPA default entity listener

The problem Sometimes we want to register a default Entity Listeners which are called as soon an entity is persisted, without adding the @EntityListeners annotation to our classes, as in most cases we anyway provide interfaces so we can access data on the entity itself. The problem is, that we cannot annotate our entity listener with…

Android Fragments and Transactions

Problem Sometimes it is confusing how fragments work in Android and interesting side effects like: Why have Fragments empty constructors? Why shouldn’t I pass state variables like they are? Why do I need this Fragment transactions? What does addToBackStack mean and do I need it? Why is sometimes the Activity null in my fragment? Overview…

Java SSLContext and the SSLSocketFactory self signed certificate

Problem Often we want to connect to create a secure SSL connection to an HTTPs endpoint which is secured by a self signed Certificate. If we do so just with a simple call we usually face an nice exception like :

Solution Often I see that either somebody uses an trust all or just…

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…

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

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…