Skip to content

Instantly share code, notes, and snippets.

View sabbarmehdi's full-sized avatar
🎯
Focusing

EL MEHDI SABBAR sabbarmehdi

🎯
Focusing
View GitHub Profile
@sabbarmehdi
sabbarmehdi / pom.xml
Created August 11, 2021 08:41
Graphql
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>5.2.4</version>
@Service
public class UserService{
@Autowired
private ItemsServiceClient itemsServiceClient;
@Autowired
protected UserRepository userRepository;
public List<Item> findAllItemById() {
Long userId = userRepository.findByEmail(getUsername()).get().getId();
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
spring.application.name=item-service
@FeignClient(name = "item-service")
public interface ItemsServiceClient {
@GetMapping(value = "/item/user-items")
public List<Item> getItems(@RequestParam Long userId);
}
@RestController
@RequestMapping("/item")
@RepositoryRestController
@RequiredArgsConstructor
public class ItemController {
@Autowired
ItemService itemService;
@GetMapping(value = "/user-items")
public ResponseEntity<List<Item>> getItemByUserId(@RequestParam(value = "userId") Long userId){
@EnableFeignClients
@SpringBootApplication
@EnableEurekaClient
public class UserApplication {
public static void main(String[] args) {
SpringApplication.run(UsersApplication.class, args);
}
}
@sabbarmehdi
sabbarmehdi / pom.xml
Last active July 16, 2021 15:19
Jasypt encrepty plugin
<build>
<plugins>
...
<plugin>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-maven-plugin</artifactId>
<version>3.0.3</version>
</plugin>
</plugins>
</build>
@sabbarmehdi
sabbarmehdi / pom.xml
Created July 16, 2021 14:05
Jasypt encrepty
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
@sabbarmehdi
sabbarmehdi / application.properties
Created July 15, 2021 15:21
Prioritize the local configurations
spring.profiles.active=native