在使用Java 11在Intellij IDEA中提取变量(ctrl + alt + v)时,我希望默认情况下将其提取为a var而不是详细类型.
var home = "127.0.0.1";
Run Code Online (Sandbox Code Playgroud)
代替
String home = "127.0.0.1";
Run Code Online (Sandbox Code Playgroud)
有没有办法配置Intellij IDEA来做到这一点?
我的应用程序在运行时生成Java代码,并使用JavaCompiler API对其进行编译.一些生成的文件可能相当大 - 高达几十万行.我发现当我在javac命令行中对生成的代码运行命令时,或者如果我使用通过JavaCompiler API进行编译的应用程序时,我可以编译许多这些文件(~500),即使它们是非常大,不到两分钟.但是,如果我在Tomcat服务器上运行时通过我的应用程序调用API,则编译时间会超过12分钟(!!!).
我将不胜感激任何有关如何提高编译性能的建议.
谢谢!
我有一个包含多个模块和一个共同父模块的maven项目.在这个项目中,有一些单元测试与Junit以及surefire一起运行,以及BDD Cucumber集成测试.我想运行两个单独的作业,一个用于运行所有单元测试,另一个用于运行BDD/Integration测试.为了做到这一点,我使用Junit类注释注释了我的BDD运行器类,如下所示:
@RunWith(Cucumber.class)
@CucumberOptions(
tags = { "@ATagToBeRun", "~@ATagNotToBeRun","~@ToBeImplemented" },
dryRun = false, strict = true,
features = "src/test/resources/cucumber/testing",
glue = { "com.some.company.test",
"com.some.company.another.test"})
@Category(value = IntegrationTest.class)
public class FlowExecutionPojoTest {
}
Run Code Online (Sandbox Code Playgroud)
我在父级中创建了一个Maven配置文件,该配置文件pom使用了maven-surefire-plugin旨在根据组过滤测试的功能.这是我的maven配置:
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-spring</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<profile>
<id>testJewels</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>../my-module</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<groups>com.some.company.IntegrationTest</groups>
</configuration> …Run Code Online (Sandbox Code Playgroud) 我正在使用HQL命名查询(在XML文件中定义)来使用Hibernate查询我的数据库.有些查询非常复杂,我发现自己将一个查询的大部分内容复制粘贴到另一个查询,类似的查询.
我想知道是否有可能在"命名查询片段"中定义公共部分并在我的所有查询中重用该片段?
我不想使用标准API,顺便说一句,因为我觉得在XML中制定查询更加舒服.其中一些已经是一个非常怪物,用API实现它们会使它们更加难以理解.