Skip to content

Commit

Permalink
Add missing @ServiceConnection annotation to reference doc sample
Browse files Browse the repository at this point in the history
Closes gh-38046
  • Loading branch information
philwebb committed Oct 25, 2023
1 parent 16c975a commit 6e65d93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

import org.springframework.boot.devtools.restart.RestartScope;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;

@TestConfiguration(proxyBeanMethods = false)
public class MyContainersConfiguration {

@Bean
@RestartScope
@ServiceConnection
public MongoDBContainer mongoDbContainer() {
return new MongoDBContainer("mongo:5.0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package org.springframework.boot.docs.features.testing.testcontainers.atdevelopm

import org.springframework.boot.devtools.restart.RestartScope
import org.springframework.boot.test.context.TestConfiguration
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean
import org.testcontainers.containers.MongoDBContainer

Expand All @@ -25,6 +26,7 @@ class MyContainersConfiguration {

@Bean
@RestartScope
@ServiceConnection
fun monogDbContainer(): MongoDBContainer {
return MongoDBContainer("mongo:5.0")
}
Expand Down

0 comments on commit 6e65d93

Please sign in to comment.