21-02-2018 21

Package and run a Java application with spring dependencies

I built a stand-alone Java application that has a bunch of dependencies (Apache Commons libs, etc) as well as a dependency on the Spring framework, which in turn has a bunch of dependencies.I built this in Eclipse, where it runs fine. Now I need to deploy it to production and so I'm trying to figure out the best way to package it with all dependencies and also how to even invoke the thing (it will be invoked from the command line).

Read More
21-02-2018 21

Spring Application Context available inside the constructor

I am having an issue when trying to create beans from a spring Application Context inside a bean instantiated by spring using constructor arguments.I have implemented the ApplicationContextAware interface but it populates the context after the instance is created (obvious).But then, if you need to get beans from the constructor, and I am talking about a variable number of objects defined at runtime, what would be the correct way to proceed?

Read More
21-02-2018 21

what do the terms formBackingObject and ModelAttribute mean in Spring MVC?

I guess I don't understand the difference between a "FormBackingObject" and a "ModelAttribute" in spring MVC.Seems like both gets initiated and populated by Spring with an incoming request.

Read More
21-02-2018 21

Using Spring JUnit4 and JMock together

When I run my Junit4 tests now I use the @RunWith(SpringJUnit4ClassRunner.class) annotation which allows me to inject Spring Beans into my test class.I would like to use the JMock 2 framework (which I have no real experience of) but examples I see require the following @RunWith(JMock.class).So my question is can I use JMock and Spring together with my JUnit4 tests and if so how? For instance is there a Spring test runner that also supports JMock?

Read More
21-02-2018 21

Referencing beans in xml config created via Annotations

This must be possible but I can't work out how or see it in the docs.I need to reference a bean which has been created via an annotation @Service and context:component-scan, within a spring xml config file.How is this achieved?Cheers

Read More
21-02-2018 21

Using session scoped Spring bean with DWR

Spring: 2.5.6.SEC01DWR: 2.0.5I would like to use a session scoped bean from DWR. It works fine, when I configure the bean to be a singleton. I read this tutor: (http://directwebremoting.org/dwr/server/integration/spring.html) and modified my applicationContext.xml, but it is still wrong somewhere.My applicationContext.xml:

Read More
21-02-2018 21

Spring+JPA+Hibernate: persist is updating the entity surprisingly. Please go through the details

In my code, I did as follows:I am confused with this behaviour of persist method.Please help me out.code is as below:

Read More
21-02-2018 21

write behind cache Ehcache new feature?

i looking for guide/document/tutorial on how to use this new feature write-behind-cache in ehcache? Is there any demo in spring+jpa+ehcache+hibernate?just to clariyfing, write-behind-cache mean each time we persist entity, it will be written into cache rather than into database correct?

Read More
21-02-2018 21

How to leverage Spring Integration in a real-world JMS distributed architecture?

For the following scenario I am looking for your advices and tips on best practices:In a distributed (mainly Java-based) system with:How would one best apply the JMS support provided by the Spring Integration framework to decouple the clients from the worker nodes? When reading through the reference documentation and some very first experiments it looks like the configuration of an JMS inbound adapter inherently require to use a subscriber, which in a decoupled scenario does not exist.

Read More