List of usage examples for org.springframework.context.annotation ScopedProxyMode INTERFACES
ScopedProxyMode INTERFACES
To view the source code for org.springframework.context.annotation ScopedProxyMode INTERFACES.
Click Source Link
From source file:com.springsource.greenhouse.config.SocialConfig.java
/** * A request-scoped bean that provides the data access interface to the current user's connections. * Since it is a scoped-proxy, references to this bean MAY be injected at application startup time. * If no user is authenticated when the target is resolved, an {@link IllegalStateException} is thrown. * @throws IllegalStateException when no user is authenticated. *///from w ww.j a v a2 s .co m @Bean @Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES) public ConnectionRepository connectionRepository() { Account account = AccountUtils.getCurrentAccount(); if (account == null) { throw new IllegalStateException("Unable to get a ConnectionRepository: no user signed in"); } return usersConnectionRepository().createConnectionRepository(account.getId().toString()); }
From source file:at.ac.univie.isc.asio.Asio.java
@Bean @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.INTERFACES) public SecurityContext currentUser() { return SecurityContextHolder.getContext(); }
From source file:com.springsource.greenhouse.config.SocialConfig.java
/** * A request-scoped bean representing the API binding to Facebook for the current user. * Since it is a scoped-proxy, references to this bean MAY be injected at application startup time. * The target is an authorized {@link Facebook} instance if the current user has connected his or her account with a Facebook account. * Otherwise, the target is a new FacebookTemplate that can invoke operations that do not require authorization. *//*from ww w. j av a 2 s.com*/ @Bean @Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES) public Facebook facebook() { Connection<Facebook> facebook = connectionRepository().findPrimaryConnection(Facebook.class); return facebook != null ? facebook.getApi() : new FacebookTemplate(); }
From source file:de.uni_koeln.spinfo.maalr.login.config.SocialConfig.java
/** * Request-scoped data access object providing access to the current user's * connections./* w w w. java2s .c o m*/ */ @Bean @Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES) public ConnectionRepository connectionRepository() { String userName = SecurityContextHolder.getContext().getAuthentication().getName(); return usersConnectionRepository().createConnectionRepository(userName); }
From source file:com.springsource.greenhouse.config.SocialConfig.java
/** * A proxy to the request-scoped API binding to Twitter for the current user. * Since it is a scoped-proxy, references to this bean MAY be injected at application startup time. * The target is an authorized {@link Twitter} instance if the current user has connected his or her account with a Twitter account. * Otherwise, the target is a new TwitterTemplate that can invoke operations that do not require authorization. *//*from w w w .j a v a 2 s .co m*/ @Bean @Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES) public Twitter twitter() { Connection<Twitter> twitter = connectionRepository().findPrimaryConnection(Twitter.class); return twitter != null ? twitter.getApi() : new TwitterTemplate(); }
From source file:de.uni_koeln.spinfo.maalr.login.config.SocialConfig.java
/** * A proxy to a request-scoped object representing the current user's * primary Twitter account.//from w w w. j a v a 2 s .c o m * * @throws NotConnectedException * if the user is not connected to twitter. */ @Bean @Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES) public Twitter twitter() { return connectionRepository().getPrimaryConnection(Twitter.class).getApi(); }