【发布时间】:2019-05-07 00:55:22
【问题描述】:
我有两个 SpringBoot 模块。 commons 和 web。
我是不是搞错了什么?我想从我的web 模块中获取commons 模块中定义的bean。
这是我的 ModulesApplication.java
package com.github.fish56.modules;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ModulesApplication {
public static void main(String[] args) {
SpringApplication.run(ModulesApplication.class, args);
}
}
ModulesApplicatonTest.java
package com.github.fish56.modules;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootApplication
public class ModulesApplicationTest {
@Test
public void isEnvOk(){}
}
更新:可以了
【问题讨论】:
-
能否添加ModulesApplication类代码?
-
@JonathanJohx 是的,我补充了一些。