Spring Bean

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 »