Created
February 7, 2017 16:42
-
-
Save Leward/38df62bed1644d1ebcdfc00c059bd5fb to your computer and use it in GitHub Desktop.
springtrader-resource-server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.springtrader.resource; | |
import org.springframework.beans.factory.InitializingBean; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | |
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; | |
import org.springframework.security.oauth2.provider.token.RemoteTokenServices; | |
import org.springframework.web.client.RestOperations; | |
import org.springframework.web.client.RestTemplate; | |
@SpringBootApplication | |
@EnableResourceServer | |
@EnableDiscoveryClient | |
public class SpringtraderResourceServerApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(SpringtraderResourceServerApplication.class, args); | |
} | |
@LoadBalanced | |
@Bean | |
RestTemplate restTemplate() { | |
return new RestTemplate(); | |
} | |
@Bean | |
InitializingBean init(RestOperations restOperations, RemoteTokenServices remoteTokenServices) { | |
return () -> remoteTokenServices.setRestTemplate(restOperations); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment