2015-02-09 5 views
7

Yay 3 dağıtımıyla dağıtımda paketlenmiş bir proje klasörü vardı. Bu proje klasöründe kullanılabilecek örnek applicationContext.xml dosya vardı. Ancak, Spring 4 dağıtımını here'dan indirdiğimde, bir proje klasörü ile gelmiyor ve ben applicationContext.xml örneğini bulamıyorum. applicationContext.xml dosyasını nerede bulabilirim.Örnek applicationContext.xml dosyasını nerede bulabilirim?

cevap

9

Daha fazla bilgi için bu adresi kullanabilirsiniz here. aşağıdaki gibi numunenin Aşağıda

yapılandırmasını içeren:

  • bileşen tarama baz com.foo kök klasör olarak hangi düşünce.
  • Temel veriler Kaynak tanımı.
  • Mülkiyet yer tutucu dosyası (database.properties) yerelleştirme desteği için
  • İleti Kaynak.

örnek BTW

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

    <context:property-placeholder location="classpath:/database.properties" /> 
    <context:component-scan base-package="com.foo" /> 


    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> 
     <property name="driverClassName" value="${jdbc.driverClassName}" /> 
     <property name="url" value="${jdbc.url}" /> 
     <property name="username" value="${jdbc.username}" /> 
     <property name="password" value="${jdbc.password}" /> 
     <property name="initialSize" value="5" /> 
     <property name="maxActive" value="10" /> 
    </bean> 

    <bean id="messageSource" 
     class="org.springframework.context.support.ResourceBundleMessageSource"> 
     <property name="basename" value="messages" /> 
    </bean> 

</beans> 
+0

applicationContext.xml Biz 4 .Annotations orada tüm job.I Thi sorunu yüz yapmak ve ardından "ApplicationConetxt" Bu dosyayı kaldırıldı için vardır Baharda ApplicationConetxt ihtiyacım yok ve onu çalıştı. – Ankur

+0

Evet bu Bahar yeni özellik değil ama tüm bloglarda bir çalışma applicationContext.xml bulmak zordur. applicationContext.xml gibi – erhun

+2

Ayrıca birçok Bahar projeler yazılır kullanarak xml dosyaları bu nedenle bu karşılaşmadan bu eski biçimi iyidir öğrenme. – Mushy