Question about Development standards I want the full exampl

@@

Question about Development standards I want the full example for the given data Separate deployment details from application context Try to divide operation details out of application context in other xml or properties file. Write the example code using beans. Question about Development standards I want the full example for the given data Use bean inheritance to reduce XML Using the parent attribute of the element and you can identify that a bean be a child of some other bean and inheriting the parent bean s properties and write the example code for it.

Solution

Q5 answer :

Property file:

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

            <property name=\"location\"><value>datasource.properties</value></property>

        </bean>

        <bean id=\"dataSource\" class=\"org.springframework.jdbc.datasource.DriverManagerDataSource\">

            <property name=\"url\"><value>${database.url}</value></property>

            <property name=\"driverClassName\"><value>${database.driver}</value></property>

            <property name=\"username\"><value>${database.user}</value></property>

            <property name=\"password\"><value>${database.password}</value></property>

        </bean>

      

datasource.properties should contain the following entries: -

                database.url=jdbc:hsqldb:mydb

                   database.driver=org.hsqldb.jdbcDriver

                   database.user=hsql

                   database.password=password

     Jndi:

        <bean id=\"myDataSource\" class=\"org.springframework.jndi.JndiObjectFactoryBean\">

            <property name=\"jndiName\" value=\"jdbc/myDataSource\" />

        </bean>

Q6 answer:

<bean id=\"abstractTxDefinition\" class=\"org.springframework.transaction.interceptor.TransactionProxyFactoryBean\" lazy-init=\"true\">

    <property name=\"transactionManager\">

        <ref bean=\"transactionManager\"/>

    </property>

    <property name=\"transactionAttributeSource\">

        <ref bean=\"attributeSource\"/>

    </property>

</bean>

<bean id=\"myService\" parent=\"abstractTxDefinition\">

    <property name=\"target\">

        <bean class=\"com.mycompany.MyServiceImpl\">

    </property>

</bean>

@@ Question about Development standards I want the full example for the given data Separate deployment details from application context Try to divide operation
@@ Question about Development standards I want the full example for the given data Separate deployment details from application context Try to divide operation

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site