use of org.springframework.core.env.Environment in project flow by vaadin.
the class SpringServlet method setProperty.
private void setProperty(String envProperty, String initParam, Properties properties) {
Environment env = context.getBean(Environment.class);
String value = env.getProperty(upperCaseToDashSeparated(envProperty));
if (value == null) {
value = env.getProperty(envProperty);
}
if (value != null) {
properties.put(initParam, value);
}
}
use of org.springframework.core.env.Environment in project alf.io by alfio-event.
the class AdminOpenIdAuthenticationManagerTest method setUp.
@BeforeEach
void setUp() {
environment = mock(Environment.class);
when(environment.getProperty(eq("openid.domain"))).thenReturn(DOMAIN);
when(environment.getProperty(eq("openid.clientId"))).thenReturn(CLIENT_ID);
when(environment.getProperty(eq("openid.clientSecret"))).thenReturn(CLIENT_SECRET);
when(environment.getProperty(eq("openid.callbackURI"), anyString())).thenReturn(CALLBACK_URI);
when(environment.getProperty(eq("openid.authenticationUrl"))).thenReturn(AUTHENTICATION_URL);
when(environment.getProperty(eq("openid.tokenEndpoint"), anyString())).thenReturn(CLAIMS_URI);
when(environment.getProperty(eq("openid.contentType"), anyString())).thenReturn(CONTENT_TYPE);
when(environment.getProperty(eq("openid.rolesParameter"))).thenReturn(GROUPS_NAME);
when(environment.getProperty(eq("openid.alfioGroupsParameter"))).thenReturn(ALFIO_GROUPS_NAME);
when(environment.getProperty(eq("openid.logoutUrl"))).thenReturn(LOGOUT_URL);
when(environment.getProperty(eq("openid.logoutRedirectUrl"), anyString())).thenReturn(LOGOUT_REDIRECT_URL);
var configurationManager = mock(ConfigurationManager.class);
when(configurationManager.getFor(eq(ConfigurationKeys.BASE_URL), any())).thenReturn(new ConfigurationManager.MaybeConfiguration(ConfigurationKeys.BASE_URL, new ConfigurationKeyValuePathLevel("", "blabla", ConfigurationPathLevel.SYSTEM)));
authenticationManager = new AdminOpenIdAuthenticationManager(environment, null, configurationManager, null, null, null, null, null, null, null, new Json());
}
use of org.springframework.core.env.Environment in project dq-easy-cloud by dq-open-cloud.
the class EcAuditConditional method matches.
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
// 获取上下文环境
Environment env = context.getEnvironment();
Boolean auditSwitch = env.getProperty(EcConditionalSwitchKey.AUDIT_SWITCH, Boolean.class);
if (auditSwitch == null) {
return true;
}
return auditSwitch;
}
use of org.springframework.core.env.Environment in project dq-easy-cloud by dq-open-cloud.
the class EcRedissonLockCondition method matches.
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
// 获取上下文环境
Environment env = context.getEnvironment();
Boolean lockSwitch = env.getProperty(EcConditionalSwitchKey.LOCK_SWITCH, Boolean.class);
if (lockSwitch == null) {
return true;
}
return lockSwitch;
}
use of org.springframework.core.env.Environment in project data-prep by Talend.
the class NoOpQuotaServiceTest method givenQuotaProperty.
private void givenQuotaProperty(String returnValue) {
Environment environment = mock(Environment.class);
when(context.getEnvironment()).thenReturn(environment);
when(environment.getProperty("dataset.quota.check.enabled")).thenReturn(returnValue);
}
Aggregations