Spring

Spring Boot Integrates slf4j and logback

The difference between slf4j and logback. Slf4j (Simple Logging Facade for Java) is a log facade of Java that implements some common apis for the logging framework. Logback is the specific logging framework. It has the same author as log4j, the new logging framework developed to address the problems of log4j. Slf4j and logback can …

Spring Boot Integrates slf4j and logback Read More »

Spring Autowire Use @Component, @Repository, @Service and @Controller Annotations

Besides define Spring beans in configuration file, Spring also provide some java annotation interface for you to make Spring bean declaration simple and easy. These interfaces are also called stereotype annotation. They are @Component, @Repository, @Service and @Controller. If you want to reference such a bean, you just need to annotate that field with @Autowired …

Spring Autowire Use @Component, @Repository, @Service and @Controller Annotations Read More »

Spring Event Publisher / Listener Example

Spring event architecture make event publish and receive so easy. You can just configure event publisher and listener object as Spring beans in application context xml file. And then use them to send and receive event in your java code. This method decoupled java event object relationship if you hardcode them in java application. This …

Spring Event Publisher / Listener Example Read More »

Spring FactoryBean Example

Spring FactoryBean is a special beans in spring framework. It can be used as a bean factory to create other Spring managed beans. You may be already familiar with built-in FactoryBean such as JndiObjectFactoryBean which is used to lookup jndi object, LocalSessionFactoryBean which is used to create hibernate session object, but this article will tell …

Spring FactoryBean Example Read More »

Spring Application Start Throw BeanDefinitionStoreException

When your Spring application startup, you may sometimes encounter such exceptions. org.springframework.beans.factory.BeanDefinitionStoreException. And the error message maybe like below.  Failed to read candidate component class: file nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file – probably due to a new Java class file version that isn’t supported yet: nested exception is java.lang.IllegalArgumentException …

Spring Application Start Throw BeanDefinitionStoreException Read More »