繁体   English   中英

春季启动应用程序测试-内存问题

[英]Spring-boot application test - memory issues

我有一个弹簧启动测试,可以启动我的应用程序并在其上运行一些测试。

我在设置应用程序堆大小时遇到​​问题。

当我通过设置了内存参数的maven和surefire运行它时,所有的东西都可以工作,但是尝试从我的IDE(Intellij)运行它却没有,并且我得到了java.lang.OutOfMemoryError:Java堆空间。

@RunWith(Parameterized.class)
@SpringApplicationConfiguration(classes = MyApplication.class)
@WebAppConfiguration
public class MyTest {

    public MyTest(String name, URL url) {
        this.url = url;
    }

    @Parameterized.Parameters...
    public static Iterable<Object[]> tests() throws IOException {
       ....
    }

    @Before
    public void setUpContext() throws Exception {
        new TestContextManager(getClass()).prepareTestInstance(this);
    }


    @Test
    public void doSomething() throws Exception {
       ...
    }
}

我想到了。

显然,我pom上的surefire插件定义优先于intellij运行配置。

我需要-Xmx1024,但它是:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
                <argLine>-Xmx256m -XX:MaxPermSize=256m</argLine>
               </configuration>
        </plugin>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM