Add missing `@ServiceConnection` annotation to reference doc sample
Closes gh-38046
This commit is contained in:
		
							parent
							
								
									16c975a9c7
								
							
						
					
					
						commit
						6e65d9380b
					
				|  | @ -20,6 +20,7 @@ import org.testcontainers.containers.MongoDBContainer; | ||||||
| 
 | 
 | ||||||
| import org.springframework.boot.devtools.restart.RestartScope; | import org.springframework.boot.devtools.restart.RestartScope; | ||||||
| import org.springframework.boot.test.context.TestConfiguration; | import org.springframework.boot.test.context.TestConfiguration; | ||||||
|  | import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | ||||||
| import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||||
| 
 | 
 | ||||||
| @TestConfiguration(proxyBeanMethods = false) | @TestConfiguration(proxyBeanMethods = false) | ||||||
|  | @ -27,6 +28,7 @@ public class MyContainersConfiguration { | ||||||
| 
 | 
 | ||||||
| 	@Bean | 	@Bean | ||||||
| 	@RestartScope | 	@RestartScope | ||||||
|  | 	@ServiceConnection | ||||||
| 	public MongoDBContainer mongoDbContainer() { | 	public MongoDBContainer mongoDbContainer() { | ||||||
| 		return new MongoDBContainer("mongo:5.0"); | 		return new MongoDBContainer("mongo:5.0"); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -17,6 +17,7 @@ package org.springframework.boot.docs.features.testing.testcontainers.atdevelopm | ||||||
| 
 | 
 | ||||||
| import org.springframework.boot.devtools.restart.RestartScope | import org.springframework.boot.devtools.restart.RestartScope | ||||||
| import org.springframework.boot.test.context.TestConfiguration | import org.springframework.boot.test.context.TestConfiguration | ||||||
|  | import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | ||||||
| import org.springframework.context.annotation.Bean | import org.springframework.context.annotation.Bean | ||||||
| import org.testcontainers.containers.MongoDBContainer | import org.testcontainers.containers.MongoDBContainer | ||||||
| 
 | 
 | ||||||
|  | @ -25,6 +26,7 @@ class MyContainersConfiguration { | ||||||
| 
 | 
 | ||||||
| 	@Bean | 	@Bean | ||||||
| 	@RestartScope | 	@RestartScope | ||||||
|  | 	@ServiceConnection | ||||||
| 	fun monogDbContainer(): MongoDBContainer { | 	fun monogDbContainer(): MongoDBContainer { | ||||||
| 		return MongoDBContainer("mongo:5.0") | 		return MongoDBContainer("mongo:5.0") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue