и заранее спасибо за вашу помощь. Не стесняйтесь сообщать мне, если вам не хватает какой-либо информации.
Я уже давно заблокирован из-за проблемы с созданием компонента с помощью Spring (обратите внимание, что я изменил имена для конфиденциальности):
Error creating bean with name 'mySessionFactory' defined in class path resource [application-name-spring-application-context.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [java.util.Properties]: Ambiguous factory method argument types - did you specify the correct bean references as factory method arguments?
Error creating bean with name 'mySessionFactory' defined in class path resource [application-name-spring-application-context.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [anotherpackage.ProprieteConnexion]: Ambiguous factory method argument types - did you specify the correct bean references as factory method arguments?
В контексте приложения name-spring-application. xml:
<bean id="mySessionFactory" factory-bean="Locator" factory-method="getSessionFactory">
<constructor-arg type="java.lang.String" value="web_hibernate-my_application_name.cfg.xml" />
</bean>
<bean id="Locator" class="randompackage.LocatorClass" factory-method="getINSTANCE" />
В классе Locator:
private static final ProprieteConnexion EMPTY_PROPERTIE_CONNEXION = new ProprieteConnexion();
public static LocatorClass getINSTANCE() {...}
public SessionFactory getSessionFactory(final String hibernateCfg) {
return getSessionFactory(hibernateCfg, EMPTY_PROPERTIE_CONNEXION);
}
public SessionFactory getSessionFactory(final String hibernateCfg, final ProprieteConnexion props) throws HibernateException {
...
}
public SessionFactory getSessionFactory(final String hibernateCfg, final Properties props) throws HibernateException {
...
}
Обратите внимание, что ProprieteConnexion и Свойства не имеют иерархической ссылки (дочерний / родительский).
Вся помощь приветствуется!
ps: Кроме того, если вам было интересно, что "connexion" - это французский для связи. Вот почему французские люди иногда пишут слова на своем языке (язык) неправильно XD