drools spring config的问题

在开发中经常会用到spring, 现在的各种框架于spring的结合也非常好。

但是并没有注意configure的时候一些格式问题,今天就碰到了格式带来的困扰。

<drools:kagent id="kagent1" kbase="kbase1" new-instance="false">
    <drools:resources>                
        <drools:resource type="DRL" source="classpath:Sample.drl" />
    </drools:resources>
</drools:kagent>

<drools:kagent id="kagent1" kbase="kbase1" new-instance="false">
    <drools:resources>
        <drools:resource type="DRL" source="classpath:Sample.drl" />
    </drools:resources>
</drools:kagent>

 

上面的两个configure看上去一模一样,但是用第一个的时候就会有错误

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [drools-services.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'drools:resources' cannot have character [children], because the type's content type is element-only.

后来跟官方的configure文件对比,发现<drools:resources>后面有一些空格,就是我用红色标出的部分。去掉这些空格之后就没有问题了。这些是从word里面copy出来的。可能带有一些word的格式信息,被xds检查的时候报的错误。如果是直接用space加的空格是不会有问题的。

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                           http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring-1.3.0.xsd

转载于:https://www.cnblogs.com/scarlettxu/p/3412428.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值