mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
23 lines
343 B
Groovy
23 lines
343 B
Groovy
@SpringBootTest(classes=Application)
|
|
class BookTests {
|
|
@Autowired
|
|
Book book
|
|
@Test
|
|
void testBooks() {
|
|
assertEquals("Tom Clancy", book.author)
|
|
}
|
|
}
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
class Application {
|
|
@Bean
|
|
Book book() {
|
|
new Book(author: "Tom Clancy", title: "Threat Vector")
|
|
}
|
|
}
|
|
|
|
class Book {
|
|
String author
|
|
String title
|
|
}
|