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

AEM, FORM Submission & Handling POST requests

AEM - Query list of components and templates

AEM 6.3 - Bundle Whitelisting - Deprecation of administrative authentication

AEM as a Cloud Service (AEMaaCS) – Architecture Overview