Spring beans.xml: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
<syntaxhighlight lang='xml'>
<syntaxhighlight lang='xml'>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--suppress SpringFacetInspection -->
<beans xmlns="http://www.springframework.org/schema/beans"
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd">
        http://www.springframework.org/schema/beans/spring-beans.xsd">


  <bean id="..." class="...">
    <bean name="blue" class="playground.spring.ioc.Blue">
    <!-- collaborators and configuration for this bean go here -->
        <constructor-arg value = "something" />
  </bean>
        <constructor-arg ref = "red" />
    </bean>


  <bean id="..." class="...">
    <bean name="red" class="playground.spring.ioc.Red">
    <!-- collaborators and configuration for this bean go here -->
        <constructor-arg value = "something else" />
  </bean>
    </bean>
 
  <!-- more bean definitions go here -->


</beans>
</beans>
</syntaxhighlight>
</syntaxhighlight>

Revision as of 19:19, 4 November 2018

Internal

Example

<?xml version="1.0" encoding="UTF-8"?>
<!--suppress SpringFacetInspection -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean name="blue" class="playground.spring.ioc.Blue">
        <constructor-arg value = "something" />
        <constructor-arg ref = "red" />
    </bean>

    <bean name="red" class="playground.spring.ioc.Red">
        <constructor-arg value = "something else" />
    </bean>

</beans>