/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
spring-5/src/test/java/com/baeldung/SpringXMLConfigurationIntegrationTest.java
23 строки
981 B
Eric Martin
Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2
01 ноя 2019, 04:43
01 ноя 2019, 04:43
3225470
Код
Авторство
О чём код?
package com.baeldung; import org.junit.Assert; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.baeldung.annotationconfigvscomponentscan.components.AccountService; import com.baeldung.annotationconfigvscomponentscan.components.UserService; public class SpringXMLConfigurationIntegrationTest { @Test public void givenContextAnnotationConfigOrContextComponentScan_whenDependenciesAndBeansAnnotated_thenNoXMLNeeded() { ApplicationContext context = new ClassPathXmlApplicationContext("classpath:annotationconfigvscomponentscan-beans.xml"); UserService userService = context.getBean(UserService.class); AccountService accountService = context.getBean(AccountService.class); Assert.assertNotNull(userService); Assert.assertNotNull(accountService); Assert.assertNotNull(userService.getAccountService()); } }