@RestController
+@EnableOAuth2Resource
+class Application extends ResourceServerConfigurerAdapter {
+
+ @Override
+ public void configure(HttpSecurity http) throws Exception {
+ http.requestMatchers()
+ .antMatchers("/api/**")
+ .and()
+ .authorizeRequests()
+ .anyRequest().authenticated();
+ }
+
+ @RequestMapping('/api')
+ String home() {
+ 'Hello World'
+ }
+
+}
+