org.springframework.web.context.annotation.ApplicationScope Java Examples

The following examples show how to use org.springframework.web.context.annotation.ApplicationScope. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityBeanFactory.java    From dolphin-platform with Apache License 2.0 5 votes vote down vote up
@Bean
@ApplicationScope
public SecurityClientRequestFactory securityClientRequestFactory() {
    final Supplier<String> securityTokenSupplier = () -> DolphinKeycloakSecurityBootstrap.getInstance()
            .tokenForCurrentRequest().orElse(null);
    final Supplier<String> realmSupplier = () -> DolphinKeycloakSecurityBootstrap.getInstance()
            .realmForCurrentRequest().orElse(null);
    final Supplier<String> appNameSupplier = () -> DolphinKeycloakSecurityBootstrap.getInstance()
            .appNameForCurrentRequest().orElse(null);
    return new SecurityClientRequestFactory(securityTokenSupplier, realmSupplier, appNameSupplier);
}
 
Example #2
Source File: SecurityBeanFactory.java    From dolphin-platform with Apache License 2.0 4 votes vote down vote up
@Bean("security")
@ApplicationScope
public SecurityContext createDolphinSession() {
    return DolphinKeycloakSecurityBootstrap.getInstance().getSecurityForCurrentRequest();
}
 
Example #3
Source File: SecurityBeanFactory.java    From dolphin-platform with Apache License 2.0 4 votes vote down vote up
@Bean
@ApplicationScope
public RestTemplate restTemplate(final SecurityClientRequestFactory requestFactory) {
    final RestTemplate template = new RestTemplate(requestFactory);
    return template;
}
 
Example #4
Source File: MetricsBeanFactory.java    From dolphin-platform with Apache License 2.0 4 votes vote down vote up
@Bean("metrics")
@ApplicationScope
public Metrics createMetrics() {
    return MetricsImpl.getInstance();
}
 
Example #5
Source File: SpringBeanFactory.java    From dolphin-platform with Apache License 2.0 4 votes vote down vote up
@Bean(name = "contextManager")
@ApplicationScope
protected ContextManager createContextManager() {
    return ContextManagerImpl.getInstance();
}
 
Example #6
Source File: ScopesConfig.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
@ApplicationScope
public HelloMessageGenerator applicationScopedBean() {
    return new HelloMessageGenerator();
}