I have an interface with a naive implementation, say I want to make a cache that caches the doIt, so I wrote a wrapper : Then, I add both implementations to my Binder: I get errors complaining about: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInj…
Tag: java
Should I keep an enum attribute when it has always the same value as a result of a new inheritance?
I have these classes: Imagine that for some reason, I need to make Car a superclass for two new classes: CombustionCar and ElectricCar. One of the new requierements is that ElectricCar’s brand attribute must be always TESLA value and not any of the other ones values. I’ve thougth some solutions: I…
Vaadin 14 show simple HTML Page
I made some kind of internal manual for a webapp that i am developing. I am using Spring Boot and Vaadin 14. How to implement a button that shows that document? The html doc is in my resources folder. I wonder if i am stupid. Or should i write my own controller for this? Answer A Vaadin application itself is
Could one gRPC server run multiple same class of service?
Consider following code I want this server to run two AService with different args, argA and argB, is it possible? If possible, when a AStub call the method, which instance of service would it call? Answer I believe it is not possible, because each service is added to a map, by name, therefore new AServiceImp…
How do I select option from a Select Listbox dynamically during runtime ? Selenium_Java
I have a select listBox of around 10 elements containing account no. with balance. These balances change sometimes they go to zero some time they have some amount, what I want to do is select the option at runtime which has a positive account balance. The format of the text in LB is : Acc no. (INR 12345 :Some…
Finding the number of nodes with int data greater than x in a binary search tree
I’m trying to recursively find the number of nodes that have int data greater than than a given int. This is being done on a binary search tree, so it makes things a bit easier in terms of finding the amount. However, my solution seems to be one-off on all of the tests I’ve run and I can’t f…
How do I apply multiple columns in GroupBy/PartitionBy in Spark Java API
If I have a list/Seq of columns in Scala like: I can easily use it in partitionBy or groupBy like But if I want to do the same thing in Spark Java API what should I do? Answer partitionBy has two signatures: So you may choose between one of the two. Let’s say that partitions is a list of String.
Quarkus JWT Returning Unauthorized on deployment
I have a Quarkus project that expose some REST Endpoints. When working on dev mode or running from the local build docker container all work fine, those endpoints annotated with @RolesAllowed and @PermitAll work as supposed to be. But when I deploy to a AWS service with the following steps: Commit to Gitlab R…
Selenium test – OK/Cancel popup disappearing immediately
Odd one here. When testing this manually I click the delete button, wait for the popup Then I click OK and the record is removed as expected. But when I try to do the same in Java/Selenium it goes like this-> or Both have the same response, the OK/Cancel popup will appear and then immediately vanish. This …
How can I make a ListView load parent and childs related by ForeignKey?
For now, I have a working ListView that successfully loads every “parent” object in the ListView, retrieving the parent attributes and showing them in every element. Due to I am trying to follow Android’s Model-View-ViewModel architecture patterns, I am using RoomDb, a Repository class and a…