Verständnis Frühling @Configuration-Klasse

Folgenden die Frage Verständnis Frühling @Autowired-Nutzung ich wollte eine umfassende Wissensbasis für die andere option des Frühlings Verdrahtung, die @Configuration Klasse.

Nehmen wir an ich habe ein spring-XML-Datei, die wie folgt aussieht:

<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd">

  <import resource="another-application-context.xml"/>

  <bean id="someBean" class="stack.overflow.spring.configuration.SomeClassImpl">
    <constructor-arg value="${some.interesting.property}" />
  </bean>

  <bean id="anotherBean" class="stack.overflow.spring.configuration.AnotherClassImpl">
    <constructor-arg ref="someBean"/>
    <constructor-arg ref="beanFromSomewhereElse"/>
  </bean>
</beans>

Wie kann ich @Configuration statt? Hat es irgendeine Auswirkung auf den code selbst?

InformationsquelleAutor Avi | 2014-06-03
Schreibe einen Kommentar