spring-annotations

how to specify a bean as non lazy with annotations

Does anyone know how to specify a bean as non lazy when using annotations to configure the bean? ...

Something like EJB wiring in Spring for non EJB's

I've noticed recently that spring can wire up my ejb's for me if I annotate the ejb with @Interceptors(SpringBeanAutowiringInterceptor.class). I've never actually done this so don't know the details. I was wondering, is there a way to get this to work with other kinds of beans, for example, @WebService annotated ones as well. At the mo...

Testing Spring @MVC annotations

I ran into a problem the other day where a @Valid annotation was accidentally removed from a controller class. Unfortunately, it didn't break any of our tests. None of our unit tests actually exercise the Spring AnnotationMethodHandlerAdapter pathway. We just test our controller classes directly. How can I write a unit or integration...

Annotation based view mapping

I am trying to get my head around annotation based mappings and I am having some trouble mapping requests directly to jsp. Do all request have to go through a controller? Is it possible to make it just go to a jsp without declaring a RequestMapping for GET? I am using a InternalResourceViewResolver. Below is my app-servlet.xml <contex...

How to get error text in controller from BindingResult

I have an controller that returns JSON. It takes a form, which validates itself via spring annotations. I can get FieldError list from BindingResult, but they don't contain the text that a JSP would display in the tag. How can I get the error text to send back in JSON? @RequestMapping(method = RequestMethod.POST) public @ResponseBody...

Spring @RequestMapping and trailing slash problem

I am trying to map a method in a Controller using the annotation with URI template: @RequestMapping(value="/select/{customerNumber}/{resource}", method=RequestMethod.GET) It appears that this does not get mapped if there is a trailing slash at the end of "resource". Update: Using Spring 3.0.2 release Update: @RequesMapping seems to ...

Spring MVC annotation config problem

I'm trying to improve my spring mvc configuration so as to not require a new config file for every servlet I add, but I'm running into problems. I've tried using this tutorial as a starting point, but I'm running into an issue that I can't figure out. The problem is that when I do a GET to my servlet, I get back a 404 error. Here's my c...

Spring Annotation based Controllers and Duplicate Form Submission

How does one disable duplicate form submission on Annotation based controllers. ...

Spring redirecting back to referrer

I have some resources in my application that require redirection to another resource (form) if some context information is not set. After the context gets set (requires two user steps), I need to redirect back to the requested resource. How do I achieve that. I am using annotation based controllers in Spring 3. Is org.springframework.sec...

Spring validation @AssertTrue

How do I display on a view jsp validation error message that occurs as a result of @AssertTrue annotation? It isn't tied to a specific field, but I am using it to validate a combination of fields. If I use <form:errors path="*"/> that will display all the errors for that form? ...

Spring 3 MVC - form:errors not showing the errors

I am using annotation based validation but for one of the forms I am not able to show any errors using the form:errors tag. When I debug the method, I can see the BindingResult has errors, but for some reason its not being displayed on the form. I am stumped as I have got it working on other forms, but for some reason this particular for...

Custom property editors do not work for request parameters in Spring MVC?

Hello, I'm trying to create a multiaction web controller using Spring annotations. This controller will be responsible for adding and removing user profiles and preparing reference data for the jsp page. @Controller public class ManageProfilesController { @InitBinder public void initBinder(WebDataBinder binder) { binde...

Spring Annotation trailing slash

I have a controller with @RequestMapping for root path "/". There are other controllers with say a @RequestMapping of "/test" etc. My application seems to be mapping correctly for paths like /appname/test, but if I add a trailing slash to the path, like so "/appname/test/ then it maps to the controller that has the @RequestMapping for ro...

How to do Spring Lookup Method Injection with Annotations?

Is there any way to use Lookup Method Injection using annotations? Given the following class: @Service public abstract class A { protected abstract createB(); } In order to get it to work I have to declare in spring applicationContext.xml the following: <bean id="b" class="com.xyz.B"> </bean> <bean id="a" class="com.xyz.A"> ...