use of org.springframework.context.annotation.Bean in project spring-framework by spring-projects.
the class WebMvcConfigurationSupport method resourceHandlerMapping.
/**
* Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped
* resource handlers. To configure resource handling, override
* {@link #addResourceHandlers}.
*/
@Bean
public HandlerMapping resourceHandlerMapping() {
ResourceHandlerRegistry registry = new ResourceHandlerRegistry(this.applicationContext, this.servletContext, mvcContentNegotiationManager());
addResourceHandlers(registry);
AbstractHandlerMapping handlerMapping = registry.getHandlerMapping();
if (handlerMapping != null) {
handlerMapping.setPathMatcher(mvcPathMatcher());
handlerMapping.setUrlPathHelper(mvcUrlPathHelper());
handlerMapping.setInterceptors(new ResourceUrlProviderExposingInterceptor(mvcResourceUrlProvider()));
handlerMapping.setCorsConfigurations(getCorsConfigurations());
} else {
handlerMapping = new EmptyHandlerMapping();
}
return handlerMapping;
}
use of org.springframework.context.annotation.Bean in project spring-framework by spring-projects.
the class ProxyTransactionManagementConfiguration method transactionAdvisor.
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
advisor.setTransactionAttributeSource(transactionAttributeSource());
advisor.setAdvice(transactionInterceptor());
advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
return advisor;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class SecurityFilterAutoConfiguration method securityFilterChainRegistration.
@Bean
@ConditionalOnBean(name = DEFAULT_FILTER_NAME)
public DelegatingFilterProxyRegistrationBean securityFilterChainRegistration(SecurityProperties securityProperties) {
DelegatingFilterProxyRegistrationBean registration = new DelegatingFilterProxyRegistrationBean(DEFAULT_FILTER_NAME);
registration.setOrder(securityProperties.getFilterOrder());
registration.setDispatcherTypes(getDispatcherTypes(securityProperties));
return registration;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class SendGridAutoConfiguration method sendGrid.
@Bean
@ConditionalOnMissingBean(SendGrid.class)
public SendGrid sendGrid() {
SendGrid sendGrid = createSendGrid();
if (this.properties.isProxyConfigured()) {
HttpHost proxy = new HttpHost(this.properties.getProxy().getHost(), this.properties.getProxy().getPort());
sendGrid.setClient(HttpClientBuilder.create().setProxy(proxy).setUserAgent("sendgrid/" + sendGrid.getVersion() + ";java").build());
}
return sendGrid;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class HashMapSessionConfiguration method sessionRepository.
@Bean
public SessionRepository<ExpiringSession> sessionRepository(SessionProperties properties) {
MapSessionRepository repository = new MapSessionRepository();
Integer timeout = properties.getTimeout();
if (timeout != null) {
repository.setDefaultMaxInactiveInterval(timeout);
}
return repository;
}
Aggregations