Description Resource Path Location Type cvc-complex-type.2.4.c: The matching wildcard is strict

前言

敲SSH网上商城的时候,报了个错,找了好几个人帮忙,都说是xml配置的问题,我自己也上网搜了很多,都一步一步照着做了,弄了俩小时终于解决了,把解决方案分享给大家。

方案一:
  • 在eclipse中window–preferences–XML–XML Catalog 右边界面add按钮后会出现一个新的界面
    选择file system 将刚才解压文件中 META-INF/dubbo.xsd选中
    需要注意两点
    1)key type 选择 schema location (默认是Namespace name)
    2)key 一定要写http://code.alibabatech.com/schema/dubbo/dubbo.xsd
    (默认http://code.alibabatech.com/schema/dubbo
    这里写图片描述
  • 关闭xml的合法验证
    这里写图片描述

    方案二:
    报错代码
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/beans/spring-tx.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/beans/spring-aop.xsd
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">
不报错的代码
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/beans/spring-tx.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/beans/spring-aop.xsd
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd"
    default-autowire="byName" default-lazy-init="false">

不知道是不是因为最后这句话解决的,还是因为我关了第一个方案中的合法验证,不过问题解决了,下面给大家分享一下default-autowire=”byName” default-lazy-init=”true”

default-autowire=”byName” default-lazy-init=”true”

default-autowire=”byName”自动装配:自动装配就是对于bean当中引用的其他bean不需要我们自己去配置它改使用哪个类,Spring 的自动装配可以帮助我们完成这些工作。

default-lazy-init=”true”:Spring配置默认default-lazy-init为false,当属性default-lazy-init设置为true时,Spring启动时不会再去加载整个对象实例图,不过这样做可以大大减小Spring的启动时间。所谓的加载整个对象实例图就是从初始化action配置、到service配置、到dao配置以及数据库连接等等。

注意:default-lazy-init该属性是配置在beans里面
同时我们可以针对具体的模块在相应的bean里面使用lazy-init 属性,lazy-init 比default-lazy-init的优先级高。

猜你喜欢

转载自blog.csdn.net/yyx3214/article/details/80612686