我有兩個使用相同數據庫對象的不同應用程序(站點+一些cron實用程序)。我將它們移到單獨的庫中,並且在應用程序中只保留了hibernate.configuration文件。現在Hibernate + Spring MVC:外部對象庫
,問題是,我有一個使用JavaMailSender一些電子郵件通知服務,它在spring配置文件中定義的屬性:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="mail.xxx.com" />
<property name="username" value="xxx" />
<property name="password" value="xxx" />
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.smtp.ssl.trust">*</prop>
</props>
</property>
</bean>
<bean id="notificationsService" class="de.crm.NotificationsService">
<property name="sender" ref="mailSender" />
<property name="properties" ref="notificationsServiceProperties" />
</bean>
<bean id="notificationsServiceProperties" class="de.crm.objects.properties.NotificationsServiceProperties">
<property name="name" value="xxx" />
<property name="email" value="xxx" />
</bean>
因此,這裏的主要問題,它不能看到de.crm .objects.properties.NotificationsServiceProperties類,因爲它是在外部庫中定義的,並且該項目在導出時失敗。
有什麼辦法可以在外部庫中保留屬性類並修復它嗎? 謝謝
UPD#1:是否可以使用來自外部庫的對象Spring的@Autowired註解?
將外部jar添加到構建路徑中還是將外部jar放置在classpath中,從中可以讀取它? – Rocky 2012-02-01 07:46:34
我已將外部jar作爲外部庫添加到Buildpath設置中 – nKognito 2012-02-01 07:51:29