SpringClassRule/SpringMethodRule 实际上是做什么的?
What does SpringClassRule/SpringMethodRule actually do?
在集成测试中 class 我遇到了这些代码行:
@ClassRule
public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule();
@Rule
public final SpringMethodRule springMethodRule = new SpringMethodRule();
当我尝试导航到 class(我使用 Intellij Idea)时,我得到 'Cannot find declaration to go to'。当我尝试查找用法时,我得到 'No usage found in the project'
我熟悉规则的概念。但是还是不明白这两个东西是干什么的。
我检查了这个页面:https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/
那里没有信息。
这些不是 Spring 特定于引导的注释,而是来自 Spring 框架本身并允许使用 Spring 上下文等而不使用 SpringRunner
.
可以在此处找到具体示例,
http://eddumelendez.github.io/blog/2015/08/01/spring-4-2-0-springclassrule-and-springmethodrule/
在集成测试中 class 我遇到了这些代码行:
@ClassRule
public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule();
@Rule
public final SpringMethodRule springMethodRule = new SpringMethodRule();
当我尝试导航到 class(我使用 Intellij Idea)时,我得到 'Cannot find declaration to go to'。当我尝试查找用法时,我得到 'No usage found in the project' 我熟悉规则的概念。但是还是不明白这两个东西是干什么的。 我检查了这个页面:https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/ 那里没有信息。
这些不是 Spring 特定于引导的注释,而是来自 Spring 框架本身并允许使用 Spring 上下文等而不使用 SpringRunner
.
可以在此处找到具体示例,
http://eddumelendez.github.io/blog/2015/08/01/spring-4-2-0-springclassrule-and-springmethodrule/