匹配通配符是严格的,但没有声明可以找到元素的属性
问题描述:
我有一个问题,弹簧配置如下。匹配通配符是严格的,但没有声明可以找到元素的属性
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing
infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving
up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources
in the /WEB-INF/views directory -->
<beans:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.novcode.date" />
<beans:bean name="employee" class="com.novcode.date.Employee"
scope="request"></beans:bean>
<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.sql.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/securepassspring" />
<property name="username" value="root" />
<property name="password" value="spuser" />
</beans:bean>
<beans:bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<value>com.novcode.date</value>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.MYSQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</beans:bean>
</beans:beans>
我面对的主要问题是,我得到的红十字标志说
我相信,我有交叉检查过很多次这个错误,我也相信我有用xsd做些事情,但我不确定abuot是否一样,因为我是春季初学者。
我的Maven如下。 。请不要担心属性中的数据可以编辑相同。
请大家帮忙, 谢谢。
答
由于你的命名空间前缀为“xmlns:beans="http://www.springframework.org/schema/beans
”,所以你需要用来解决这个错误,如果你声明你的命名空间是这样的,那么你不需要在任何地方定义bean。
[这可能对您有帮助](http://stackoverflow.com/a/12226551/2749470)和[this too](http://stackoverflow.com/a/10523227/2749470) – 2015-02-09 08:46:53
使用所有 2015-02-09 08:50:26
我请求xml文件与更改,因为我尝试了建议的更改,但没有工作。 Sts没有提供正确的xml文件..或者可能是我不完全知道要更改什么.. – Abhijeet 2015-02-09 09:28:48