JavaFX Beans Binding suddenly stops working

The binding uses a WeakListener to observe the value of currentWidthPlusTen. Since you don’t keep a reference to the boundNumberProperty, it is eligible for garbage collection as soon as the start(…) method exits. When the garbage collector kicks in, the reference is lost entirely and the binding no longer works. To see this directly, add … Read more

JPA 2.0 : Exception to use javax.validation.* package in JPA 2.0

As @Korgen mentioned in comments hibernate-validator-5.x.x isn’t compatible with validation-api-1.0.x. This is because of moving to new specification JSR-303 -> JSR-349. There are two ways to solve this issue: 1. Downgrade hibernate validator version (which is implements JSR-303): <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.3.1.Final</version> </dependency> 2. If you don’t want to move back from hibernate validator 5 … Read more

Spring cannot find bean xml configuration file when it does exist

Thanks, but that was not the solution. I found it out why it wasn’t working for me. Since I’d done a declaration: ApplicationContext context = new ClassPathXmlApplicationContext(“beans.xml”); I thought I would refer to root directory of the project when beans.xml file was there. Then I put the configuration file to src/main/resources and changed initialization to: … Read more

How to convert a Java object (bean) to key-value pairs (and vice versa)?

Lots of potential solutions, but let’s add just one more. Use Jackson (JSON processing lib) to do “json-less” conversion, like: ObjectMapper m = new ObjectMapper(); Map<String,Object> props = m.convertValue(myBean, Map.class); MyBean anotherBean = m.convertValue(props, MyBean.class); (this blog entry has some more examples) You can basically convert any compatible types: compatible meaning that if you did … Read more

tech