Java

Spring Boot log MDC

Spring Boot contains a quite nice configuration for logback with color coding and good readability. But it lacks logging MDC (Mapped Diagnostic Context) content. I tried around and found a way to append MDC to every logged line by setting the console pattern in my application.properties/yml under logging.pattern.console to Without any MDC set this adds

Spring Boot log MDC Read More »

Spring Boot Hibernate 2nd level cache with ehcache next to spring-cache with gradle build

It’s quite easy to mix up spring-boot-start-cache with 2nd level caching in hibernate. In this post I want to take down how to enable both and being able to run tests from within intellij and gradle (which isn’t the default if you just follow most tutorials). To have proper dependencies for this i added the

Spring Boot Hibernate 2nd level cache with ehcache next to spring-cache with gradle build Read More »

hibernate.id.new_generator_mappings

“true or false. Setting which indicates whether or not the new IdentifierGenerator implementations are used for AUTO, TABLE and SEQUENCE. Default to false to keep backward compatibility. Note We recommend all new projects to use hibernate.id.new_generator_mappings=true as the new generators are more efficient and closer to the JPA 2 specification semantic. However they are not

hibernate.id.new_generator_mappings Read More »

JBoss show JDBC Queries

Sometimes it is necessary to see which queries are executed and what the parameters of these queries have been. To get this data from a JBoss 7+ you have to follow these steps: Enable JDBC-Spy on Datasource: /subsystem=datasources/data-source=ExampleDS/:write-attribute(name=spy,value=true) Or just add spy=”true” as attribute in standalone.xml. Then you have to enable the spy by adding a

JBoss show JDBC Queries Read More »

JSF 2.2 ViewScoped

JSF 2.2 has the missing ViewScoped annotation working with CDI. Simply use @javax.faces.view.ViewScoped on your bean. Be careful NOT to mix up with @javax.faces.bean.ViewScoped. Example view scoped class: import javax.faces.view.ViewScoped; import javax.inject.Named; @ViewScoped @Named public class SenderView implements Serializable { } If you use the wrong annotation you will get weld errors when trying to inject an instance

JSF 2.2 ViewScoped Read More »