我有两个使用相同数据库对象的不同应用程序(站点+一些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