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 as a Cloud Service (AEMaaCS) – Architecture Overview

Custom synchronisation or rollout action for blueprint ?

AEM as a Cloud Service (AEMaaCS) – Quick Introduction

Generating URL based on AEM RUN mode using AEM Externalizer Service