When to use value tag and value attribute?

A bean can be configured using either value attribute/tag, constructor injection. We should use value tag only when we need to configure a property instance variable in a class, else we should avoid it. Below is an example




<bean id="mappings" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="properties">

<value>

jdbc.driver.className=com.mysql.jdbc.Driver

jdbc.url=jdbc:mysql://localhost:3306/mydb

value>

property>

bean>

Comments

Popular posts from this blog

Sling Authentication

CQ Development - OSGi bundles and Components

Create an AEM (CQ) project using Maven

Multiple log files using log4j appender