-
Notifications
You must be signed in to change notification settings - Fork 394
Open
Labels
status/need-triageTeam needs to triage and take a first lookTeam needs to triage and take a first look
Description
We have an application with 2 profiles. (this worked in version 3)
- The behavior between @activeprofiles and spring.profiles.active= is different. Where we would not expect this.
- When using spring.profiles.active= we get application failed to start because it tries to autoconfigure a command it shouldn't
When we run tests we start the application with @activeprofiles("profileName") this works like expected.
When we run the application with java jar spring.profiles.active="profileName" - jar app.jar we get the following exception. (see at the end)
Even though in our profile it should not try to load this command and this "beanName".
How to reproduce:
- Create an spring shell application
- Create 2 spring profiles that load separate packages
- Try to run the jar with spring.profiles.active=
GOAL
- Make @ActiveProfile and spring.profiles.active= behave the same way
- Make spring.profiles.active= not load commands that are not within the active profiles components.
one profile config:
@Configuration
@Profile("profileName")
@ComponentScan(basePackages = "com.example.profileName")
public class profileNameConfiguration {
}Test with profile:
@ActiveProfiles("profileName")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
classes = {Application.class},
args = "helloWorld")
@ExtendWith(OutputCaptureExtension.class)
class ProfileTest {
@Test
void testCommandOutput(CapturedOutput output) {
assertThat(output).contains("Hello world!");
}
}Log when running with profile:
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
ERROR 21 --- [main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Method commandRegistry in org.springframework.shell.core.autoconfigure.CommandRegistryAutoConfiguration required a bean of type 'beanName' that could not be found.
Action:
Consider defining a bean of type 'BeanName in your configuration.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status/need-triageTeam needs to triage and take a first lookTeam needs to triage and take a first look