gpt4 book ai didi

java - 获取 "Attribute "ref“必须为元素类型 "property"声明。”

转载 作者:行者123 更新时间:2023-12-01 16:51:18 25 4
gpt4 key购买 nike

请检查第 21 行,我在下面的 XML 中遇到错误

Check this image

Latest XML file

最佳答案

下面是正确的 spring bean 配置应该是什么样的 -

<?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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/Banking"></property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>


<bean id = "mysessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" ></property>

<property name = "mappingResources">
<list>
<value>credentials.hbm.xml</value>
</list>
</property>

<property name = "hibernateProperties">
<props>
<prop key="hibernate.hbm.ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>


</bean>

<bean id="template" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean>

<bean id="d" class="com.javatpoint.EmployeeDao">
<property name="template" ref="template"></property>
</bean>
</beans>

关于java - 获取 "Attribute "ref“必须为元素类型 "property"声明。”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61681908/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com