Spring:@TestConfiguration

Aus Alexander's Wiki

Abweichende Properties-Datei

Annotation in der Testklasse um die application-text.yaml Datei zu verwenden:

@ActiveProfiles(profiles = "test")

Überprüfung während des Starts der AprinApplication:

INFO  [main] o.s.b.SpringApplication: The following profiles are active: test

Spezieller ApplicationContext

Annotation der Test-Klasse

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

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