spring

Spring application root variable

I access my Spring application right now as follows: http://localhost:8080/my-app In my JSPs I'd like to have access to my application root instead of hardcoding hyperlinks to the homepage as <a href="/my-app">. Is there some sort of variable that I can access in my jsps to point to the application root? Thanks ...

AOP use cases? ........

Hi, I'd like to make a picture of what are the possible cases for effective invovement of AOP in application design. All I have met so far is: logging-related security checks transaction management tweaking of a legacy application Anything else? (It doesn't have to be necessarily Spring's proxy based AOP - rather JBoss AOP.) (Rela...

Getting Exception for Spring File upload

Hi , I am getting following Exception at the time of uploading the file using spring file upload functionality. trying to uplaod 291 KB jpg file. For less than 50 kb file it works properly. Following are bean entries <bean id="fileUploadController" class="com.businesscaliber.controller.FileUploadController"> <property name="...

spring jdbc RowCallbackHandler nightmare

I'm having trouble retrieving data from my database using Spring Jdbc. Here's my issue: I have a getData() method on my DAO which is supposed to return ONE row from the result of some select statement. When invoked again, the getData() method should return the second row in a FIFO-like manner. I'm aiming for having only one result in me...

Questions to Determine Spring / Spring Security, etc Knowledge

I requested Spring / Spring Security, etc training at work, and the bosses want to hire someone who knows Spring to come work with us as a consultant so that we'll learn Spring from a real-world perspective instead of a training perspective. I've been tasked with coming up with questions of various difficulty to ask potential hires in o...

TestNG multithreaded test with Spring @Transactional

I am using TestNG to test persistence Spring modules (JPA+Hibernate) using AbstractTransactionalTestNGSpringContextTests as a base class. All important parts @Autowired, @TransactionConfiguration, @Transactional work just fine. The problem comes when I am trying to run test in parallel threads with threadPoolSize=x, invocationCount=y Te...

Spring hibernate query help

currently I am using the following to pull rows from a table called Table: return getHibernateTemplate().find("from Table"); How do I use hibernate to pull only the first n rows from the table (i.e. like a mySql limit would do)? Thanks. Update: so is this the proper way to do it? getHibernateTemplate().setMaxResults(35); return get...

Spring controller setup question?

I am using Spring MVC to develop a Java webapp. I have a setup as follows: 2 pages of the site are responsible for rendering similar content. One of the pages simply renders the items slightly differently (and hence would need a different view), and pulls the data slightly differently (with a limit on the query instead of pulling all t...

JAXB and Jersey list resolution?

I have the following XSD defined to generate some jaxb objects. It works well. <xsd:element name="Person" type="Person" /> <xsd:complexType name="Person"> <xsd:sequence> <xsd:element name="Id" type="xsd:int" /> <xsd:element name="firstName" type="xsd:string" /> <xsd:element name="lastName" type="xsd:string" ...

Load environment-specific properties for use with PropertyPlaceholderConfigurer?

This seems like a pretty common problem, but I haven't found any sort of consensus on the best method, so I'm posing the question here. I'm working on a command-line Java application using Spring Batch and Spring. I'm using a properties file along with a PropertyPlaceholderConfigurer, but I'm a little unsure of the best way of handling ...

How to cluster and load balance a Spring + OSGi app

Hi I am considering to develop an web application with Spring and OSGi. It seems like they fit together nicely. What are the options for clustering and loadbalancing such an app and what are the pros and cons of each? Thanks ...

Java - Spring MVC - Automatically populate object from form submission?

In ASP.NET MVC in the controller I can just have an object from my model be a parameter in one of my methods, and a form submission that gets handled by that method would automatically populate the object. eg: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(User u){...} The user object will automatically be populated for be f...

jsp error message not displaying

on JSP when I want to display error messages but when it returns to JSP page by <form:errors path="arnNumber" cssClass="error" /></span> it is giving me an exception org.springframework.context.NoSuchMessageException: No message found under code 'ARN number is required.contactUsUtil.arnNumber' for locale 'en_US'. ...

Spring+JPA+Hibernate: persist is updating the entity surprisingly. Please go through the details.

Hi, In my code, I did as follows: queried for a course entity populate it with the given course data. courseDao.update(entity) which internally calls persist(entity) method. Surprisingly, the data is got updated successfully. I am confused with this behaviour of persist method. Please help me out. code is as below: //My Service....

Is it possible to specify a class name for Spring Framework in an external file?

Hi all, I have an application built on the Spring Framework that uses an external properties file for some things like database host string, username and password so that we can check the configuration file into our repository (it's open source) and not compromise the security of the db. It also is great because developers can keep the...

Some help with hibernate Criteria query

Can somebody please help me complete / clean up this query. I am trying to first get the number of rows in the table, then I need to actually fetch a set of rows. I am not sure how I can use the same criteria instance to perform both queries. To fetch the count I have something like this: Criteria criteria = session.createCriteria(My...

Invoking Concrete Methods From an Abstract Class Using Spring

Hello guys, I am in a tough spot and I cannot figure it out. I am using legacy code and we are migrating from PicoContainer 1.1 to Spring 2.5. I came across code where Pico grabs the abstract class and is able to invoke concrete methods. How can I do that in Spring? This is what I tried in Spring so far: <bean id="module" class="a....

Request handling methods in spring

Which method is better to used to handle the request whether to use requestHandle of AbstractController or formBackingObject of AbstractFormController in the spring framework? ...

Spring MVC Session Attribute Access

Is there any way under spring 3.0 to access the HttpSession without including it in the method signature? What I really want to do is be able to pass in values from an HttpSession that CAN BE null. Something like this: @RequestMapping("/myHomePage") public ModelAndView show(UserSecurityContext ctx) {} instead of this: @RequestMappin...

how to do background computing in Spring 3.0?

In a spring application I want do some background computing. The task is that I save an entity( lets say a GPS coordinate) and then I want to query a web service to get distance between all the coordinates and store them in the db for later use. There is a possibility that after storing the entity, connection cannot be made to the web se...