Search in sources :

Example 56 with Primary

use of org.springframework.context.annotation.Primary in project mots by motech-implementations.

the class TokenConfiguration method tokenServices.

/**
 * Set-up CustomTokenServices with tokenStore().
 * @return token services
 */
@Bean
@Primary
public CustomTokenServices tokenServices() {
    TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain();
    tokenEnhancerChain.setTokenEnhancers(Arrays.asList(tokenEnhancer(), accessTokenConverter()));
    CustomTokenServices customTokenServices = new CustomTokenServices();
    customTokenServices.setTokenStore(tokenStore());
    customTokenServices.setTokenEnhancer(tokenEnhancerChain);
    customTokenServices.setClientDetailsService(clientDetailsService);
    customTokenServices.setSupportRefreshToken(true);
    customTokenServices.setAccessTokenValiditySeconds(tokenValiditySeconds);
    customTokenServices.setRefreshTokenValiditySeconds(tokenValiditySeconds * 2);
    customTokenServices.setReuseRefreshToken(false);
    return customTokenServices;
}
Also used : TokenEnhancerChain(org.springframework.security.oauth2.provider.token.TokenEnhancerChain) CustomTokenServices(org.motechproject.mots.security.token.CustomTokenServices) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean)

Example 57 with Primary

use of org.springframework.context.annotation.Primary in project nakadi by zalando.

the class JsonConfig method jacksonObjectMapper.

@Bean
@Primary
public ObjectMapper jacksonObjectMapper() {
    final ObjectMapper objectMapper = new ObjectMapper().setPropertyNamingStrategy(CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
    objectMapper.registerModule(enumModule());
    objectMapper.registerModule(new Jdk8Module());
    objectMapper.registerModule(new ProblemModule());
    objectMapper.registerModule(new JodaModule());
    objectMapper.configure(WRITE_DATES_AS_TIMESTAMPS, false);
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    return objectMapper;
}
Also used : Jdk8Module(com.fasterxml.jackson.datatype.jdk8.Jdk8Module) JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) ProblemModule(org.zalando.problem.ProblemModule) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean)

Example 58 with Primary

use of org.springframework.context.annotation.Primary in project taskana by Taskana.

the class RestConfiguration method dataSourceProperties.

@Bean
@Primary
@ConfigurationProperties(prefix = "datasource")
public DataSourceProperties dataSourceProperties() {
    DataSourceProperties props = new DataSourceProperties();
    props.setUrl("jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS TASKANA");
    return props;
}
Also used : DataSourceProperties(org.springframework.boot.autoconfigure.jdbc.DataSourceProperties) Primary(org.springframework.context.annotation.Primary) ConfigurationProperties(org.springframework.boot.context.properties.ConfigurationProperties) Bean(org.springframework.context.annotation.Bean)

Example 59 with Primary

use of org.springframework.context.annotation.Primary in project kylo by Teradata.

the class LivyWranglerConfig method jobTrackerService.

/**
 * Creates the job tracker service.
 */
@Bean
@Primary
public JobTrackerService jobTrackerService(@Nonnull final SparkScriptEngine sparkScriptEngine, @Nonnull final SparkListenerService sparkListenerService) {
    final JobTrackerService jobTrackerService = new JobTrackerService(sparkScriptEngine.getClassLoader());
    sparkListenerService.addSparkListener(jobTrackerService);
    return jobTrackerService;
}
Also used : JobTrackerService(com.thinkbiganalytics.spark.service.JobTrackerService) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean)

Example 60 with Primary

use of org.springframework.context.annotation.Primary in project mybatis.flying by limeng32.

the class DataSourceConfig method dataSource1.

@Bean("dataSource1")
@Primary
public AtomikosDataSourceBean dataSource1() {
    AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
    ds.setXaDataSource(xaDataSource1());
    ds.setUniqueResourceName("testdb");
    ds.setMinPoolSize(1);
    ds.setMaxPoolSize(3);
    ds.setMaxIdleTime(60);
    return ds;
}
Also used : AtomikosDataSourceBean(com.atomikos.jdbc.AtomikosDataSourceBean) Primary(org.springframework.context.annotation.Primary) AtomikosDataSourceBean(com.atomikos.jdbc.AtomikosDataSourceBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Primary (org.springframework.context.annotation.Primary)93 Bean (org.springframework.context.annotation.Bean)90 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)15 SqlSessionFactoryBean (org.mybatis.spring.SqlSessionFactoryBean)13 SQLException (java.sql.SQLException)10 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)10 PathMatchingResourcePatternResolver (org.springframework.core.io.support.PathMatchingResourcePatternResolver)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)7 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)6 DefaultTokenServices (org.springframework.security.oauth2.provider.token.DefaultTokenServices)6 JavaTimeModule (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)4 ConfigurationProperties (org.springframework.boot.context.properties.ConfigurationProperties)4 JodaModule (com.fasterxml.jackson.datatype.joda.JodaModule)3 LocalDateSerializer (com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer)3 LocalDateTimeSerializer (com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer)3 LocalTimeSerializer (com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer)3 XmAuthenticationContext (com.icthh.xm.commons.security.XmAuthenticationContext)3 XmAuthenticationContextHolder (com.icthh.xm.commons.security.XmAuthenticationContextHolder)3 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)3