The method getRealPath(String) from the type ServletRequest is deprecated

See following example to get the real server file path via servletRequest.getRealPath(“/”). However, warning is prompt and complained that this method is deprecated. import javax.servlet.http.HttpServletRequest; public class DisplayAction { private HttpServletRequest servletRequest; public String execute() { //The method getRealPath(String) from the type ServletRequest is deprecated String filePath = servletRequest.getRealPath("/"); } @Override public void setServletRequest(HttpServletRequest arg0) …

Read more

Hibernate – The type AnnotationConfiguration is deprecated

Problem Working with Hibernate 3.6, noticed the previous “org.hibernate.cfg.AnnotationConfiguration“, is marked as “deprecated“. Code snippets … import org.hibernate.cfg.AnnotationConfiguration; //… private static SessionFactory buildSessionFactory() { try { return new AnnotationConfiguration().configure().buildSessionFactory(); } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } The code is still working, just keep displaying the deprecated …

Read more