Showing posts with label spring. Show all posts
Showing posts with label spring. Show all posts

Wednesday, May 16, 2012

Do I really need a service layer?


My web application is written using Spring MVC + Hibernate.



  • My model is "Customer" entity POJO.

  • I have got a DAO object "CustomerDAO", its method "saveCustomer(c)" contains the code interacting with Hibernate;

  • Then I created a " CustomerService with a "saveCustomer(c)" method who simply pass the customer object to the dao for saving;

  • Finally there are "CustomerController" and customer.jsp, who are responsible for the view layer, the jsp's form fields are bound to a Customer object on the controller side. The controller calls the service.

Wednesday, April 25, 2012

How to define a List bean in Spring?


I'm using Spring to define stages in my application. It's configured that the necessary class (here called Configurator ) is injected with the stages.

Monday, April 16, 2012

Why Spring Framework?


I hear nowadays a lot about the Spring Framework. Why is there so much buzz around the Spring Framework in the industry?

Thursday, March 8, 2012

Why is Spring"s ApplicationContext.getBean considered bad?


I asked a general Spring question and had multiple people respond that calling Spring's ApplicationContext.getBean() should be avoided as much as possible. Why is that?

Tuesday, February 28, 2012

Spring 3 setting ThreadFactory for ThreadPoolTaskExecutor


Is this possible or is it managed by the Application Server? Passing the ThreadPoolTaskExecutor ref to a bean is a no-brainer but trying to set the threadfactory on the aforementioned executor seems to have no effect ...

Saturday, February 25, 2012

Image is not displayed on reterival


I have a table with Images stored in it as BLOB. I'm using JPA/Hibernate. So, that Images are mapped to a bean field with type blob. Now my Spring controller is returning entire list of bean (each object of this bean has a blob object) to my jsp. I want to display all the images on that jsp. So, I tried to use some thing like this on my jsp,

Tuesday, February 21, 2012

In a test I can find a xml, in another I can"t


I have an interesting problem, I have two web services defined in a spring-conf.xml file and I have two test classes that live in the same package and every class has its own link to this spring-conf.xml file to call their particular webservice. I am able to get beans from one of my test classes but from the other one I can't and the code is equal in both classes.

What maven dependency need to have Class LocalContainerEntityManagerFactoryBean?


In my project class LocalContainerEntityManagerFactoryBean not found. I don't understand why? In other simple project with this class all works fine.

JBOSS 7.1.0 error - Unable to find a public constructor for class org.jboss.resteasy.core.AsynchronousDispatcher


I am trying to migrate my spring MVC based REST application to Jboss 7.1.0. At startup, the Jboss initialisation shows that everything was started up correctly with all war files deployed successfully.