@Endpoint
s. When I expose it in the properties file in tests, it works fine as those properties are resolved and evaluated before AutoConfiguration
decides with @ConditionalOnAvailableEndpoint
, however, I want to avoid forcing everyone to manually put some configs, and rather I expose it programmatically
application.yml
/metrics
endpoint. Bydefault, it's /actuator/prometheus
Too many open files
I tried several solutions until migrating spring boot 2.2.2 then jetty but after a while I still receive org.eclipse.jetty.server.HttpChannel - handleException /api/sender java.io.IOException: Too many open files
What can be the problem ? Thank you
EnvironmentPostProcessor
gets evaluated before those @Conditional...
s are evaluated? 2. If I add it there, then if clients want to say exclude it in their application.yml
, then what's the behaviour? what takes the precedence? My guess is that it can be handled in the EnvironmentPostProcessor
:)
management.endpoints.web.exposure.include
is that it takes a comma-separated list. So in this case, if you add a new property source for each endpoint (in my case they are in different modules and each has its own EnvPostProcessor), then the one which is first in the order, is the one that's exposed, and the rest is not exposed. In this case, is it fair to solution to scan through environment.propertySources
and find the first instance where management.endpoints.web.exposure.include
is defined and alter (append new endpoint) it there? Or is there a better way?
@ImportAutoConfiguration(classes = {
MessageSourceAutoConfiguration.class
})
public class I18nConfig {
/* some beans */
}
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = I18nTest.TestConfig.class)
@ActiveProfiles("test")
public class I18nTest {
/* tests are here */
@TestConfiguration
@Import({
I18nConfig.class
})
public static class TestConfig {
}
}
I want to run the same junit5 tests class 3 times, each time with a context property set to a different value. Is there a nice way to do that?
@ParameterizedTest
is only method not class level, and whilst I could use @DirtiesContext(AFTER_EACH_TEST_METHOD)
to recreate the context that is quite expensive to do per test and I can't see how to set the context property before the context is initialized.