use of org.springframework.context.annotation.Primary in project nifi-registry by apache.
the class IdentityProviderFactory method getIdentityProvider.
@Bean
@Primary
public IdentityProvider getIdentityProvider() throws Exception {
if (identityProvider == null) {
// look up the login identity provider to use
final String loginIdentityProviderIdentifier = properties.getProperty(NiFiRegistryProperties.SECURITY_IDENTITY_PROVIDER);
// ensure the login identity provider class name was specified
if (StringUtils.isNotBlank(loginIdentityProviderIdentifier)) {
final IdentityProviders loginIdentityProviderConfiguration = loadLoginIdentityProvidersConfiguration();
// create each login identity provider
for (final Provider provider : loginIdentityProviderConfiguration.getProvider()) {
identityProviders.put(provider.getIdentifier(), createLoginIdentityProvider(provider.getIdentifier(), provider.getClazz()));
}
// configure each login identity provider
for (final Provider provider : loginIdentityProviderConfiguration.getProvider()) {
final IdentityProvider instance = identityProviders.get(provider.getIdentifier());
instance.onConfigured(loadLoginIdentityProviderConfiguration(provider));
}
// get the login identity provider instance
identityProvider = getIdentityProvider(loginIdentityProviderIdentifier);
// ensure it was found
if (identityProvider == null) {
throw new Exception(String.format("The specified login identity provider '%s' could not be found.", loginIdentityProviderIdentifier));
}
}
}
return identityProvider;
}
use of org.springframework.context.annotation.Primary in project litemall by linlinjava.
the class JacksonConfig method objectMapper.
@Bean
@Primary
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
objectMapper.registerModule(javaTimeModule);
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return objectMapper;
}
use of org.springframework.context.annotation.Primary in project litemall by linlinjava.
the class JacksonConfig method objectMapper.
@Bean
@Primary
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
objectMapper.registerModule(javaTimeModule);
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return objectMapper;
}
use of org.springframework.context.annotation.Primary in project springBoot-learn-demo by nbfujx.
the class DruidOneConfig method SqlSessionFactoryOne.
// 创建Session
@Primary
@Bean
public SqlSessionFactory SqlSessionFactoryOne() throws Exception {
final SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSourceOne());
Resource[] resource = new PathMatchingResourcePatternResolver().getResources(DruidOneConfig.MAPPER_LOCATION);
sqlSessionFactoryBean.setMapperLocations(resource);
return sqlSessionFactoryBean.getObject();
}
use of org.springframework.context.annotation.Primary in project goci by EBISPOT.
the class DepositionSyncApp method getObjectMapper.
@Bean(name = "JodaMapper")
@Primary
public ObjectMapper getObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JodaModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false).configure(SerializationFeature.INDENT_OUTPUT, true).setSerializationInclusion(JsonInclude.Include.NON_NULL);
return mapper;
}
Aggregations