Jackson custom deserializer for one field with polymorphic types

Jackson processes @JsonTypeInfo before choosing which Deserializer to use, probably because the choice of Deserializer could depend generally on the type. However, you can easily disable this on a per-field basis the same way you specify custom Deserializer – by annotating the field directly: @JsonDeserialize(using = DefinitionDeserializer.class) @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) private Definition definition;

Thread.sleep() VS Executor.scheduleWithFixedDelay()

You’re dealing with sleep times termed in tens of seconds. The possible savings by changing your sleep option here is likely nanoseconds or microseconds. I’d prefer the latter style every time, but if you have the former and it’s going to cost you a lot to change it, “improving performance” isn’t a particularly good justification. … Read more

Embedding resources (images, sound bits, etc) into a Java project then use those resources

Just put those resources in the source/package structure and use ClassLoader#getResource() or getResourceAsStream() to obtain them as URL or InputStream from the classpath by the full qualified package path. ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream(“/image.gif”); // … Or if it is in the same package as the current class, you can also obtain … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)