Spring:@TestConfiguration: Unterschied zwischen den Versionen

Aus Alexander's Wiki
(Die Seite wurde neu angelegt: „<syntaxhighlight lang="java" line="1"> @TestConfiguration static class EmployeeServiceImplTestContextConfiguration { @Bean public Comm…“)
 
K
Zeile 1: Zeile 1:
<syntaxhighlight lang="java" line="1">
Annotation der Test-Klasse<syntaxhighlight lang="java" line="1">
@Import(CommentServiceTest.EmployeeServiceImplTestContextConfiguration.class)
</syntaxhighlight><syntaxhighlight lang="java" line="1">
     @TestConfiguration
     @TestConfiguration
     static class EmployeeServiceImplTestContextConfiguration {
     static class EmployeeServiceImplTestContextConfiguration {

Version vom 10. November 2021, 11:27 Uhr

Annotation der Test-Klasse

@Import(CommentServiceTest.EmployeeServiceImplTestContextConfiguration.class)
    @TestConfiguration
    static class EmployeeServiceImplTestContextConfiguration {

        @Bean
        public CommentMapper employeeService() {
            return new CommentMapper() {
                 // implement methods
            };
        }
        
    }