Skip to content

Bootstrapping Guice injector

I have a scenario where I will need some objects injecting at the start like logging, but then other objects injected on demand. What I don’t know is if in my console application, do I just call: in my Main function and then when I need another object, the type that I need on demand, do I use a Provider

CompletableFuture from Callable?

Today I experimented with the “new” CompletableFuture from Java 8 and found myself confused when I didn’t find a runAsync(Callable) method. I can do it myself like shown below, but why is this (to me very obvious and useful utility method) missing? Am I missing something? Answer You are supp…

Error code -7 when trying to install release APK

I’ve taken all appropriate steps to create the release APK. (Demonstration of steps required) My device (Nexus 7 2012) is set to allow installs from unknown sources. I emailed the APK (app-release.apk) to myself and attempted to open it from GMail, as this should work. EDIT: I apologize, I also should h…

Jenkins CLI connection refused

When executing I’m getting connection refused for some reason. Jenkins version is 1580.3, user has the permissions on Jenkins server, cli jar is up-to-date and ssh public key is configured properly. Any idea what might be causing this? Here’s the stack trace if it will help: Answer If the connecti…

How to inject property value using @Value into static fields

I have one property file config.properties which is configured using spring property placeholder. This is how it’s configured in my spring configuration file: Now I need to set its value to static field using @Value annotation. How can I achieve this? Answer The only way is to use setter for this value …

How JDBC Statement.setFetchsize exactly works

I want to implement this methods functionality in my custom JDBC driver. Which method from JDBC should I use to setMaxResults? If my query results is 1000 rows and I have set the value for setFetchSize=100, then what will be the results? It will return only 100 row or after returning first 100 it will get nex…