spring

Controller's life-cycle in Spring MVC

What is the lifecycle of a Controller in Spring MVC? When is the controller created, when destroyed? Is it shared among multiple threads? Can it be in use simultaneously by more than one request. ...

Hibernate: Foreign key has the wrong number of columns

Hi guys, I have defined a many-to-many relationship between my two entity classes User and Permission. User has a primary key composite of username and countyId, and my Permission table has a regular integer Id. The table UserPermission has the three foreign keys as its primary key: username, countyId and permissionId. Since this is a ...

flushmode can only used one time?

Inside my applicationContext, I have 2 dao . if i assign my 2nd dao below to use flushmode, i will get error invalid; nested exception is org.xml.sax.SAXParseException: Attribute value "org.springframework.orm.hibernate3.HibernateAccessor.FLUSH_COMMIT" of type ID must be unique within the document. On the other hand, when i excluded flu...

How to modify beans defined in a spring container

I have two xml files defining beans for the springframework (version 2.5.x): containerBase.xml: <beans> <bean id="codebase" class="com.example.CodeBase"> <property name="sourceCodeLocations"> <list> <value>src/handmade/productive</value> </list> </property> </bean> </beans...

Spring & Struts2 REST - junit tests

I have three hierarchical layers injected in Spring - rest, business logic and database operations. Junit tests for BL and DAO are working OK, when rest can inject only business logic ioc layer. My supper class for junit tests: import org.springframework.test.AbstractTransactionalSpringContextTests; public class AbstractTest extends A...

How should I handle having one identical form on many pages in Spring MVC

Title says it all really. I have a login form that has some validation on many pages in my website. How best do I structure my controllers to avoid repeating the validation logic etc. Bear in mind some of these pages have their own controller requirements e.g. reference data. So one exactly identical controller cannot be used. The ...

GWT + Spring: NullPointerException on getServletContext() call

Hi, I'm currently experimenting with GWT and Spring. More specifically I wanted to make the GreetingService sample to work with Spring on the server side. There are a couple of articles available for realizing this (I'm linking them here since some of you may be interested): http://ice09.wordpress.com/2009/05/25/google-app-engine-spri...

XML Vs Annotations: Analytical approach

I intend to use the Pugh Decision Matrix to analytically reach a decision on this long running debate about the best approach (only with an academic interest though, it will be difficult to take sides). I invite you to suggest appropriate criteria for the comparison between these two approaches. ...

Specifying Java path for properties file

I have a Java Spring project, configured with Maven. As the amount of unit tests and their configuration files is adding up rapidly, I'm trying to centralize the test configurations to one properties file (the same one, which is used in building the project). The unit tests are located (relative to the project path, of course) in tree s...

Is it possible in Springframework 2.5.6 to have scope="session" create the object on session create

I've got a project using Jetspeed portal and Springframework 2.5.6 where I need a Jetspeed level service to be unique for each user logged in. This would be best done using Spring AOP and scope="session". The problem is, that these are behind the scenes beans that need to be running as soon as the session in initiated. It appears that ...

Spring pre-authentication cannot update user principal

I have a problem where I can't seem to get my Spring MVC application to recognize a change in the user principal. The application I am using implements a preAuthentication mechanism for authentication. The problem occurs when a user logs into my authentication system, logs out, and then a new user logs back in. The custom authentication ...

how to make java enum elements configurable

hello guys i'm not sure if the title is descriptive enough.what i mean is creating an enum like so public enum Test{ ONE, TWO ,THREE } this looks like hard coded.if for some reason i need to add the FOUR some certain business rules evolution reasons.should i code it and deploy it again? isn't a way to let it pick the elements from ...

Cappuccino and Spring

Does anyone have experience with making Cappuccino-based webapps that consume REST-based webservices from Spring? Any recommended tutorials? Or just Capuccino/AJAX tutorials? Any thoughts on this combination? Cheers Nik ...

How can I get aop:config to work with BeanFactoryPostProcessor in spring

I am trying to prototype some aop logic to handle logging logic. While I am doing it, I thought I would be nice to use BeanFactoryPostProcessor (not BeanPostProcessor) to automatically set bean name to 'name' property of target beans, so I can use it for logging if needed. I got the aop autoproxying logic (aop:config) working before...

Spring RDBMS vs JDBCTemplate

How much of a performance difference is there between these two models? What kind of reasons are there for using one over the other? In my application I am using a lot of the same statements over and returning both Objects and primitives. There are a few oracle stored procedure calls and performance on these is a top priority. ...

Convert XML based configuration to Annotations

Is there any Utility available to convert XML based config files (say in Spring or Hibernate) to Annotations? If not would it be worthwhile to build such a tool? ...

How to log the time taken by methods in Springframework?

Is it possible in springframework to log the time taken by methods [ selective | all ] automatically. By automatically i mean, i don't want to go to each method and write the log.debug ( "...." ); stuff. ...

how to create Thread poolling using Spring scheduler?

Hi, I want a sample for thread pooling using Spring scheduler? ...

acegi ntlm how to?

I have an application that using ldap acegi-security-1.0.2.jar . I able to authenticate the user with active directory. I wanted to add NTLM auto login feature for my application. May i know what extra acegi library do i need to do this? is there any example on acegi+nltm on this? ...

Apache CXF: How to secure JAX-RS web service with basic authentication

I have a Spring application that publishes some RESTful web services using Apache CXF (using jax-rs). I would like to secure access to those services using HTTP basic authentication. The username and password should be in a Spring configuration file. The main application already uses Spring Security and I would prefer not to mess with th...