How to Trigger an Async Query
Query methods defined in repositories can be executed asynchronously. This means that the query method will return immediately upon invocation. The sample code below relies on @Async annotation and Future,
Query methods defined in repositories can be executed asynchronously. This means that the query method will return immediately upon invocation. The sample code below relies on @Async annotation and Future,
In order to selectively expose CRUD operations, we need to define an intermediate interface, annotated as below: @NoRepositoryBeaninterface IntermediateRepository extends Repository { // add here the selected CRUD, for example
For defining a SynchronousQueue in Java, we need the BlockingQueue interface as follows: BlockingQueue queue = new SynchronousQueue();
Converting List to Set: List list = Arrays.asList(1, 2, 3);Set set = new HashSet(list); Converting Set to List: Set set = Sets.newHashSet(1, 2, 3);List list = new ArrayList(set);
The quickest solution for sorting an array in Java relies on Arrays.sort() method as below: int[] arr = {5, 12, 3, 44, 55}; Arrays.sort(arr);
Consider a Review object with three properties: article, book and magazine. Let’s assume that only one of these three properties should be set as non-null. For checking this constraint we
The best way to declare a Pattern in Java is as a constant, since Pattern is immutable. Use the following code: private static final Pattern PATTERN = Pattern.compile(” +”); Further,
If we have a code-point, we can check if it is a Unicode surrogate pair as follows: int cp = some_code_point;if(Character.charCount(cp) == 2) { // 2 means a surrogate pair
Port BindExceptions can occur if a port is already occupied by some other process and you try to use it again. Below is a simple example that demonstrates this and