spring

Resolving a view that is outside the application container

I'm building a Java Spring app, and I'm working around a few constraints in the production environment, due to the fact that content is being published from a CMS. I have my images, js, css and jsp views residing in a static folder. I'm running a Tomcat app server, and i've set up Virtual directory mappings in the server.xml to map the i...

Spring @Transactional is applied both as a dynamic Jdk proxy and an aspectj aspect

I am in the process of adding Spring declarative transactions via the @Transactional annotation to an existing Java project. When I ran into a problem (unrelated to this question), I turned on full debug logging. Curiously, I noticed the following: 17:47:27,834 DEBUG HibernateTransactionManager:437 - Found thread-bound Session [org.hi...

Spring Transaction propagation issue

I am using Transaction management with Spring and Hibernate. My situation is as follow: I have got bean A which is sorrounded by transaction and it call bean B which is defined with transaction including the attribute 'PROPAGATION_REQUIRED' B in this case doesn't open new transaction but uses the exsiting one (saw in the logs: 'Partici...

How to create a Generic DAO class using Hibernate Context sessions

I'm trying to implement a Generic DAO using the Hibernates Context Sessions. Following was my shot:| import java.io.Serializable; public interface GenericDao<T, ID extends Serializable> { /** Persist the newInstance object into database */ ID create(T newInstance); /** * Retrieve an object that was previously persisted to the da...

ApplicationContext.getBean(Class clazz) doesn't go well with proxies

I have a bean definition in Spring and it's proxy counterpart which is meant to be used everywhere: <bean name="my.Bean" class="org.springframework.aop.framework.ProxyFactoryBean" scope="prototype"> <property name="proxyInterfaces" value="my.Interface"/> <property name="target" ref="my.BeanTarget"/> <property name="interceptorName...

Education path for someone wanting to be a spring developer?

Right now I have very basic Java skills (by basic I mean some basic JSP's that query databases and produce reports... not much more! However I work in a very Java world, lots of web-facing J2EE apps running on various Appservers and have also a lot of contact with SpringSource via our heavy usage of Hyperic as a platform monitoring solu...

What are the new Features of Spring 3 (compared to Spring 2.5) ?

Hi, Does someone can tell me what's new in Spring 3 and the difference to two (Spring 2.5 and Spring 3)? Thank you in advance ...

Jaxb marshaller ang generics(2)

there are types: class A{} @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER) @XmlType(propOrder = {"obj"}) @XmlRootElement(name = "response") public class B<T extends A> extends A{ private T obj; @XmlElement(required = true) public T getObj() { return obj; } } When i'm trying to marshal this i get an error: org.springframew...

Using OpenSessionInViewInterceptor to avoid LazyInitializationException

First I need to acknowledge the fact that I'm new to EJB, JPA and Spring, so many of the things I believe as true could be wrong. I'm building an EJB application where there's an stateless session bean used to retrieve many JPA (Hibernate) entities. The problem, which I believe is a widespread problem, is that I cannot traverse the rela...

How to add multiple custom-filter in Spring Security 3?

I need add two custom filters for FORM_LOGIN_FILTER, e.g. <custom-filter after="FORM_LOGIN_FILTER" ref="myUsernamePasswordAuthenticationFilter" /> <custom-filter after="FORM_LOGIN_FILTER" ref="myUsernamePasswordAuthenticationFilter2" /> What I expect the filter sequences is: 1. Predefind FORM_LOGIN_FILTER 2. myUsernamePasswordAuthent...

JSF do not interpret placeholder in <h:outputText value="#{tableRow.x}" />

Hi all, I am mixing jsf,richfaces and spring together (faces backing beans = spring beans) and I have a jsp page with a table. For some strange reason tag <rich:dataTable value="#{inputBean.table}" var="tableRow"> calls inputBean.getTable() method and construct output table with the same amount table rows which table(List) has -> #{i...

I've injected HttpServletRequest into a bean. How do I unit test it ?

I have a bean in which I've injected an HttpServletRequest using the @Autowired annotation. This injection works correctly when the application context is a web application Context. That's not the case for application contexts for JUnit tests with Spring. How can I test this bean ? Maybe I can mock an http request, but then how to inj...

How to intercept all Hibernate sessions when they're created (Spring / Grails environment)

Is there a way of intercepting all new Hibernate sessions when they're created? I need to access each Session instance to enable a Hibernate filter with a parameter. The only solution I've gotten working has involved wrapping the SessionFactory, but this involved a lot of semi nasty hacks as well as it required me to implement around 6...

Spring MVC File Upload Help

I have been integrating spring into an application, and have to redo a file upload from forms. I am aware of what Spring MVC has to offer and what I need to do to configure my controllers to be able to upload files. I have read enough tutorials to be able to do this, but what none of these tutorials explain is correct/best practice metho...

Spring MVC - How to map individual methods in a controller without anotation use

Hi, I am very new to Spring framework in general. How can I map individual methods in a controller, so that I can call any other method other than handleRequestInternal for example. Also I do not want to use annotation (@RequestMapping). Thank you manu ...

OSGi vs Spring vs Struts vs EJB vs. Hibernate -- a totally newbie's question

I am not familiar with these "framework" "components" at all, but can someone give me a 101 introduction about what the relationship they are to each other? Basically, I want to know roughly about: what and what are counterparts to each other what and what are complementary technology (e.g., A as a framework can be used with B as a com...

java swing, spring, hibernate session transaction problem.

How do I make sure that there is only 1 sessionfactory/session/transaction when i run a test case? Currently in my test case the DataBase changes (that i make in the test case) are not visible in the application code. Here is the base class of the test. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/spring...

Does Spring 3.0 provides a service definition file?

I'm wondering about Spring 3.0 whether it provides an automatically generated service definition page after I defined services. With SOAP we have a WSDL file which contains WHAT, HOW and WHERE we can call a service. Is that possible with Spring 3.0 or not? ...

persist data in bean between each method calls MultiActionController

Hi Is it possible to persist data in bean between each method calls MultiActionController? fist method should be able to create new Person and the second method should be able to use the object I have tried the following not sure why UI Model is created for every method call? I am expecting a “myUser” (UI model) to bind to form fiel...

Quick Spring MVC question: If I don't return a model, how come I can still render a view via the response?

I can use: return new ModelAndView(viewName, model); Or I use: response.setContentType("text/plain"); response.getWriter().print("Hello World!"); Now where's the difference n design, other that I dont need a JSP in the second solution. But I could also output a flestream right? Maybe I just need a little bit more understanding. Ho...