Skip to content

Commit

Permalink
make feign client work with eureka
Browse files Browse the repository at this point in the history
  • Loading branch information
sqshq committed Jan 26, 2016
1 parent e269ca5 commit 9ed6bde
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(name = "statistics", url = "http://statistics-service/statistics")
@FeignClient(name = "statistics-service")
public interface StatisticsClient {

@RequestMapping(method = RequestMethod.GET, value = "/")
@RequestMapping(method = RequestMethod.GET, value = "/statistics")
String fire();

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public String hello(Principal principal) {
return "hello from account service, " + principal.getName();
}

//@PreAuthorize("#oauth2.hasScope('ui')")
@RequestMapping(path = "/fire", method = RequestMethod.GET)
public String fire(Principal principal) {
return "fired: " + client.fire();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
Expand All @@ -27,7 +26,6 @@

@SpringBootApplication
@EnableResourceServer
@EnableDiscoveryClient
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class AuthApplication {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//package com.piggymetrics.repository;
//
//import com.piggymetrics.domain.User;
//import org.springframework.data.repository.CrudRepository;
//import org.springframework.stereotype.Repository;
//
//@Repository
//public interface UserRepository extends CrudRepository<User, Long> {
//
// User findByUsername(String username);
//
//}
package com.piggymetrics.repository;

import com.piggymetrics.domain.User;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRepository extends CrudRepository<User, Long> {

User findByUsername(String username);

}

0 comments on commit 9ed6bde

Please sign in to comment.