Spring Tutorial

Autowire Spring Bean By Name Examples

Besides declare spring bean dependencies in the bean configuration file, the spring framework provides the autowire function to make bean dependency declaration easily. There are below autowire modes, they are no-autowire, autowire by bean name, autowire by bean class type, autowire by constructor. This article will show you examples of autowire beans by name.

Autowire Spring Bean By Name Examples 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 »

How To Inject Value To Spring Bean Properties

If you want to set your Spring bean’s property value in a bean configuration file, you can use the below methods. Use property tag under bean tag. <bean id=”beanPropsInjection” name=”beanPropsInjection” class=”com.dev2qa.example.spring.BeanPropertiesInjection”> <property name=”loginUserName” value=”dev2qa.com”></property> <property name=”loginPassword” value=”dev2qa.com”></property> </bean> Use bean tag attribute prefixed with the p schema. But before do the below configuration, you should

How To Inject Value To Spring Bean Properties Read More »

Spring Component Scan Instruction

After you configure <context:component-scan base-package=”com.dev2qa.examples”> in Spring bean configuration xml file, Spring container can automatically scan the java files under base-pack and it’s sub packages. If it has scanned the classes with annotations like @Component, @Service, @Repository or @Controller, the container will register these classes as managed bean.

Spring Component Scan Instruction Read More »