- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在我的项目中使用Spring-Cache机制。
我做了什么
我的 applicationContext.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:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="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 http://www.springframework.org/schema/cache/spring-cache.xsd">
<context:component-scan base-package="com.yahoo.comma"/>
<bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase">
<property name="dataSource" ref="dataSource"/>
<property name="changeLog" value="classpath:liquibase/changelog.xml"/>
<property name="defaultSchema" value="pryme"/>
</bean>
<cache:annotation-driven/>
<!-- generic cache manager -->
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches">
<set>
<bean class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean" p:name="default"/>
</set>
</property>
</bean>
</beans>
在我的一个类上,我有以下内容
@Cacheable("ages")
@Nonnull
public List<Age> getAges() {
return ageRepository.findAll();
}
当我使用maven-cargo
插件部署它时,我在日志中看到失败为
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) [catalina.jar:7.0.52]
[INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_55]
[INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_55]
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_55]
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_55]
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55]
[INFO] [talledLocalContainer] Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cache:annotation-driven'.
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] Jul 16, 2014 10:33:12 AM org.apache.catalina.core.StandardContext listenerStart
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 16 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 31; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cache:annotation-driven'.
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1917) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:766) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:355) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
[INFO] [talledLocalContainer] at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347) ~[na:1.7.0_55]
[INFO] [talledLocalContainer] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer] ... 26 common frames omitted
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
[INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] Caused by: org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 31; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cache:annotation-driven'.
即使我有也不确定
http://www.springframework.org/schema/cache/spring-cache.xsd
为什么我会遇到这个问题?
最佳答案
您的 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:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="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
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
关于java - 找不到元素 'cache:annotation-driven' 的声明。?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24787269/
我的问题是 this one. 的一个分支 我有一个要验证的注释(比如电话注释)。我可以使用@phone 验证器来检查电话对象是否有效。我还希望能够将此验证器放在包含电话的联系信息对象上。有没有一种方
我的问题是 this one. 的一个分支 我有一个要验证的注释(比如电话注释)。我可以使用@phone 验证器来检查电话对象是否有效。我还希望能够将此验证器放在包含电话的联系信息对象上。有没有一种方
例如 class LoggingService [Inject] (protected val logger: Logger) class LoggingService @Inject (protec
你觉得你是java高手吗? 您是否深谙反射 API 的 secret ? public @interface @a {} public @interface @b {} @Mark public @i
我对 Spring 和 JUnit 非常陌生。我正在尝试为 spring 服务类运行一个简单的 JUnit 测试用例,但它失败了,我得到了这个异常。我还没有编写任何测试,但在实现之前尝试运行。使用to
对于spring和JUnit来说是非常新的东西。 我正在尝试为spring服务类运行一个简单的JUnit测试用例,但是失败了,并且出现了这个异常。我还没有编写任何测试,但是尝试在实现之前进行测试。 使
我有一个实体Test,它将从特征中获取它的属性(和基本方法): class Test { use Trait_title; } trait Trait_title{ /** *
我(当然)正在尝试使用许多我不太了解的构造来维护一个项目。在尝试弄清楚 Spring 中 AOP 使用的过程中,我遇到了带有以下注释的方法: @Around(value = "@annotation(
目前我正在编写一个注释处理器,它将生成新的源代码。该处理器与应用程序本身隔离,因为它是构建项目的一个步骤,我将整个构建系统与应用程序分开。 这就是问题开始的地方,因为我想处理在应用程序中创建的注释。我
我将 Vertx Service Gen 注释处理器与 Kotlin kapt 结合使用。 在注释处理器启动之前,我的 kapt 失败,到处都是以下异常消息: error: scoping const
我很难弄清楚如何从其实际实现类中获取对 java.lang.annotation.Annotation 的引用。 注释本身看起来像这样(来自框架): @Target({ElementType.TYPE
如何创建类似的注释 @Table(name="batch", uniqueConstraints= @UniqueConstraint(columnNames = {"compound_id"
我刚开始使用Spring Boot,我收到这个错误已经有一段时间了,不幸的是无法修复它。从那时起,我一直在谷歌上搜索,但仍然找不到我做错了什么。在我的代码下面找到:。实体。刀。主要。误差率。启动App
输出文本: Execution failed for task ':app:checkDebugDuplicateClasses'. 1 exception was raised by worker
假设我想使用宏注释来复制@specialized(Int) 之类的注释——我知道这很疯狂。像这样的东西: class expand(expanded: Any*) extends Annotation
假设我想使用宏注释来复制@specialized(Int) 之类的注释——我知道这很疯狂。像这样的东西: class expand(expanded: Any*) extends Annotation
注解处理过程中我目前正在处理一个方法的注解: @Override public boolean process(Set elements, RoundEnvironment env) { Mess
我有接口(interface)资源和几个实现它的类,例如音频、视频...此外,我创建了自定义注释MyAnnotation: @MyAnnotation(type = Audio.class) cl
我的项目包括较旧的未注释 Controller 和较新的基于注释的 Controller 。 我使用的是最新的 Spring jar (3.0.5),在我的 dispatcher-servlet.xm
我正在写一些简单的 win32 东西,我正在使用以下 wWinMain int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance
我是一名优秀的程序员,十分优秀!