建立:
我已经按照https://www.playframework.com/documentation/2.4.0/JavaCache上的手册来分离缓存并使用我在application.conf中配置的不同配置(缓存大小,生命周期等):
play.cache.bindCaches = ["mycache1-cache","mycache2-cache"]
Run Code Online (Sandbox Code Playgroud)
然后,为了配置它们,我创建了通常的ehcache.xml文件
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">
<defaultCache
maxBytesLocalHeap="256000000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
maxElementsOnDisk="10000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<cache name="mycache1-cache"
maxBytesLocalHeap="256000000"
eternal="false"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
overflowToDisk="true"
maxElementsOnDisk="1000000"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="1200"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
Run Code Online (Sandbox Code Playgroud)
它只在我保留defaultCache时有效,但是一旦我添加了自定义缓存,就会抛出以下内容:
ProvisionException:无法配置,请参阅以下错误:1)自定义提供程序中的错误net.sf.ehcache.ObjectExistsException:缓存mycache1-cache已存在
但是,如果我只在ehcache.xml中定义缓存而不是在application.conf中定义缓存,则play不知道它并抛出.
https:// www.playframework.com/documentation/2.4.x/JavaDependencyInjection上的文档提到DI现在已集成到框架中:
开箱即用,Play提供了基于JSR 330的依赖注入支持.Play附带的默认JSR 330实现是Guice,但是可以插入其他JSR 330实现.
我找不到任何使用Spring的HOWTO或工作示例.
https:// www.playframework.com/documentation/2.4.x/Tutorials上的当前文档链接到示例"Play with Spring Data JPA",网址为https:// typesafe.com/activator/template/play-spring-data -jpa但评论已经提到它已经过时了.此外,在GitHub页面https:// github.com/typesafehub/play-spring-data-jpa上有一些未解决的问题,提到它在Play 2.4.0中不起作用.
代码是2年,仍然使用Global.java类来引导Spring.我没关系,但由于方法getControllerInstance(),代码在Play 2.4中不再编译.
这个项目https:// github.com/jroper/play-spring看起来很有前景,但它在Scala中,并列出了许多TODO,以及https:// github.com/jroper/play-spring/blob/上的SpringApplicationLoader类master/core/src/main/scala/play/api/inject/spring/SpringApplicationLoader.scala看起来太复杂了我想要的只是启动一个简单的Spring上下文.
现在看起来我必须降级Play以使用旧的Global.java黑客(并找出所需的所有更改......)
(一些编辑将这些链接重新放入,它们是合法的,它不会让我......)
我在 x64 Java 上使用 IntelliJ 14.3。可用内存:10Gb(总 RAM 16Gb)
(基本设定-Xmx8000M或更大)
问题是我需要超过 4Gb 的内存来用于应用程序。我找不到任何问题的答案或解决方案,我已经寻找了好几天了。
我一直在 stackoverflow 上寻找提出同样问题的人,但他们对默认值有问题-Xmx512M,并且不断链接到其他答案,链接到另一个答案(浪费时间,到目前为止还没有解决方案)。
我尝试了以下方法但不起作用:
idea64.exe.vmoptionsIntelliJ的文件:似乎没有做任何事情,没有错误,没有内存增加,什么都没有。(看起来它忽略了该文件)JAVA_OPTIONS:使 IntelliJ 在启动时崩溃或冻结,而不使用比以前更多的内存。1512M相同的堆大小问题*笔记:
我工作场所的某人可以在 IntelliJ 中将其设置为工作(但我们不知道如何
在命令行中运行该类-Xmx8000M似乎可以工作,但我想在 IntelliJ 中设置它以便于使用
如果有人遇到这个问题并可以提出解决方案,我会礼貌地要求他们这样做。