How does spring.jpa.hibernate.ddl-auto property exactly work in Spring?

For the record, the spring.jpa.hibernate.ddl-auto property is Spring Data JPA specific and is their way to specify a value that will eventually be passed to Hibernate under the property it knows, hibernate.hbm2ddl.auto. The values create, create-drop, validate, and update basically influence how the schema tool management will manipulate the database schema at startup. For example, … Read more

What is the difference between ApplicationContext and WebApplicationContext in Spring MVC?

Web Application context extended Application Context which is designed to work with the standard javax.servlet.ServletContext so it’s able to communicate with the container. public interface WebApplicationContext extends ApplicationContext { ServletContext getServletContext(); } Beans, instantiated in WebApplicationContext will also be able to use ServletContext if they implement ServletContextAware interface package org.springframework.web.context; public interface ServletContextAware extends Aware … Read more

Spring JSF integration: how to inject a Spring component/service in JSF managed bean?

@ManagedBean vs @Controller First of all, you should choose one framework to manage your beans. You should choose either JSF or Spring (or CDI) to manage your beans. Whilst the following works, it is fundamentally wrong: @ManagedBean // JSF-managed. @Controller // Spring-managed. public class BadBean {} You end up with two completely separate instances of … Read more

SPRING MVC getting 404 error in when you hits the submit button

index.jsp <html> <body> <form action=”add” method=”post”> <input type=”text” name=”t1″> <input type=”text” name=”t2″> <input type=”submit”> </form> </body> </html> controller.java package com.test; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class addController { @RequestMapping(“/add”) @ResponseBody public String add() { return “display.jsp”; } } web.xml <?xml version=”1.0″ encoding=”UTF-8″?> <!– webapp/WEB-INF/web.xml –> <web-app xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” version=”3.0″> <display-name>Archetype … Read more