spring

spring framework why is better

What is better spring framework or ejb? ...

suggest a best book for spring

Hi I just deployed onto spring project. I don't even know a little about spring framework. I just want learn Spring framework with a guidance of a best book. Can you please suggest me the books that should cover version 3.0. ...

Creating a session scoped bean in Google App Engine using Spring 2.5

Hi, I am trying to create a session bean in spring mvc. I am having the following error message when I run my google app engine server in my local box: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'siteController' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Cannot res...

How to use same view-state with different views in spring web flow

Hey Guys, I am trying to find the way to use same view-state but with different views so that based on where it is being called, I can provide different view to the user. For instance, trying to achieve as follows: <var name="searchpage" value="search.jsp"> <view-state id="searchBusiness" view="${searchpage}"/> Please shar...

Spring with Castor - Null Pointer Exception when initialising Application Context

Hi, I'm trying to register my castor mapping files with spring and I appear to be getting a null pointer exception. In my application context I have: <bean id="xmlContext" class="org.castor.spring.xml.XMLContextFactoryBean"> <property name="mappingLocations"> <list> <value>DistributionSamplerMappings.xml</value>...

Spring 3 pet clinic example uses ${owner.new}, in the JSTL EL where can I read about out about .new operator?

Spring 3 pet clinic example uses ${owner.new}, in the JSTL EL where can I find out more about where the .new comes from and what spec it is a part of? Ive seen empty and not empty operators/ reserved words but not .new until now in the Spring 3 pet clinic example.hers is the line im questioning: <h2><c:if test="${owner.new}">New </c:if...

Define DataSource bean on code

I would like to make a "First Access Database Setup Process" in my spring application and the only thing I can imagine as a solution would be to initialize the DataSource bean programatically. My current bean is defined as: <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name=...

How to override a Spring bean based on web server

Hi, I'm building a webapp that should run on both Tomcat and WebSphere and I've managed to make almost all the differences into properties with default values that I can override for deployment on the Tomcat server. I need to do yet another override for the authentication provider bean... public void postProcessBeanFactory(Configurab...

Getting the OpenID URL from a Grails Controller/Service

I'm using acegi 0.5.2 and enabled OpenID support. I would like to know how to accesss the URL (or username) returned by a provider (i.e. Google, Yahoo!). I can't find any docs about that so I traced the code of acegi and found this in GrailsOpenIdAuthenticationProvider: OpenIDAuthenticationToken response = (OpenIDAuthenticationToken) au...

DAO, Spring and Hibernate

Correct me if anything is wrong. Now when we use Spring DAO for ORM templates, when we use @Transactional attribute, we do not have control over the transaction and/or session when the method is called externally, not within the method. Lazy loading saves resources - less queries to the db, less memory to keep all the collections fetch...

Streaming large result sets with MySQL

I'm developing a spring application that uses large MySQL tables. When loading large tables, I get an OutOfMemoryException, since the driver tries to load the entire table into application memory. I tried using statement.setFetchSize(Integer.MIN_VALUE); but then every ResultSet I open hangs on close(); looking online I found that tha...

How do you see a good Spring+Hibernate DAO module design?

First, we create classes that represent db entities, ok, done. Let's say we use Hibernate session factory and JPA annotations. Now we must create a DAO: getUserById, getAllUsers() etc. What do you recommend about transaction management, session factory, how a good design to be made? ...

Spring 3.0: Handler mapping issue

I am having a trouble mapping a specific URL request to one of the controllers in my project. the URL is : http://HOSTNAME/api/v1/profiles.json the war which is deployed is: api.war the error I get is the following: [PageNotFound] No mapping found for HTTP request with URI [/api/v1/profiles.json] in DispatcherServlet with n...

How to configure RetryAdvice and ExceptionTranslation for Deadlocks using NHibernate and Spring

Hi, i am using Spring.net 1.2 with NHibernate 2.0.1. Within my project i'am facing some Deadlock issues and besides the database tweaks to minimize the occurence i would like to implement Springs RetryAdvice to handle this. I can't find any working example how to configure a this. The reference seems to be clear about how to use it but ...

Fill a list from JSP in Spring

Hello, I have something like this in my Spring Application: public class Book{ public Book(){ sheets = new LinkedList<Sheet>(); } protected List<Sheet> sheets; //getter and setter } I add several Sheets to the sheet list and I print a form in a JSP like this: <form:form modelAttribute="book" action="${dest_...

Spring Application Context Switch at Runtime

Hi, I'm wondering if it is possible to change which application context your app is using at run time. The use case would be: I have a GUI that allows you create queuing networks. It also allows you to select which simulation library you would like to use run the model you've just created. Each library has its own application contex...

Spring Security - Persistent Remember Me Issue

I've been trying to track down why Spring Security isn't creating the Spring Security remember me cookie (SPRING_SECURITY_REMEMBER_ME_COOKIE). However, based on what I see via the HTTP headers the cookie is being set it's just that there is an additional GET request for /j_spring_security_check that is causing the exception below. This a...

Spring factory beans not always initialised before being used.

Hi, I am using spring to initialise my beans. I have configured a bean which I intend to use as a factory bean. <bean id="jsServicesFactory" class="x.y.z.JSServicesFactory" /> It is a very basic class - which has 4 getter methods. One example is public final PortletRegistry getPortletRegistry() { PortletRegistry registry = (...

Unit Testing Hibernate's Optimistic Locking (within Spring)

I'd like to write a unit test to verify that optimistic locking is properly set up (using Spring and Hibernate). I'd like to have the test class extend Spring's AbstractTransactionalJUnit4SpringContextTests. What I want to end up with is a method like this: @Test (expected = StaleObjectStateException.class) public void testOptimist...

MultiActionController no longer receiving requests?

I was attempting to make changes to my controller, and all of a sudden, I no longer seem to receive any requests (404 when attempting to hit the servlet mapped URLs). I'm sure I've broken my web.xml or app-servlet.xml, but I just don't see where. I can access index.jsp from tomcat (http://IP/app/index.jsp), but I can't get my servlet map...