The Spring test module provides the @ActiveProfiles annotation inside the test class. This annotation activates the profile in the test environment. Beans associated with that profile are instantiated and also those beans which are not associated with any profile instantiated. For example, there are two profiles activated—prod and dev:
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes=TestConfig.class) @ActiveProfiles( { "prod", "dev" } ) public class AccountServiceImplTest { ... }