使用 Spring Initializr 初始化 Gradle Native 登录服务项目
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package top.ddupan.iam.login;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@Import(TestcontainersConfiguration.class)
|
||||
@SpringBootTest
|
||||
class IamLoginApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package top.ddupan.iam.login;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
||||
public class TestIamLoginApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.from(IamLoginApplication::main).with(TestcontainersConfiguration.class).run(args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package top.ddupan.iam.login;
|
||||
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.testcontainers.grafana.LgtmStackContainer;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
class TestcontainersConfiguration {
|
||||
|
||||
@Bean
|
||||
@ServiceConnection
|
||||
LgtmStackContainer grafanaLgtmContainer() {
|
||||
return new LgtmStackContainer(DockerImageName.parse("grafana/otel-lgtm:latest"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user