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

18 篇文章 1 订阅
前言

敲SSH网上商城的时候,报了个错,找了好几个人帮忙,都说是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的优先级高。

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值