spring

How can I get Spring to fatally exit if an Error is propagated out of a remote call

I have an application which exposes a service via Spring's RMI proxy mechanism. There is a problem whereby sometimes a "blip" on the file-server it has its JARs stored on causes an invocation to propagate a NoClassDefFoundError back to the caller. So far, so fair enough. The thing is, I would like my app to just crash if this happens - ...

User thread spawning in Jetty

I have a web application running over Jetty, and I need to spawn a thread for idle connection handling. This thread is being started in the spring context. I know it's not a good practice to spawn threads in a container, but couldn't find a better way to do this. Any ideas? ...

Spring Error in creating bean with name propertyPlaceholderConfigurer defined in Classpath

Hi Experts We are loading the beans with xml files in class path using the ClassPathXmlApplicationContext. It finds and loads the xml files from classpath ,but in one of xml files which has propertyPlaceholderConfigurer bean referring the property file from classpath. It throws the null pointer exception with unable to create the prope...

Simplest way to achieve HTTP Basic auth popup in Spring 3 when using annotated configuration

I've been trying to figure out how to get a basic HTTP Basic auth pop-up on a particular controller and its methods but can't seem to figure it out. The examples and documentation seem to all use XML configuration and I'm configuring my app entirely with annotations. I just need a simple, hard coded username/password login. Any suggestio...

If you use a regular HTML <form> tag instead of the Spring <form:form> tag, how do you specify where it's submitted?

In the Spring docs, the section on multipart support has an example of specifying a multipart form as this: <form method="post" action="upload.form" enctype="multipart/form-data"> This doesn't use the Spring form tags which I am familiar with and instead submits the form to the upload.form action. How does Spring know what upload.for...

[Spring 3] Autowiring a service into a validator

This example is a bit contrived; I've simplified it to remove extraneous details and to focus on the problem I am having. I have a validator that looks like this: @Component public class UniqueUsernameValidator implements ConstraintValidator<UniqueUsername, String> { @Autowired UsernameService usernameService; @Override ...

Spring Security needs ContextLoaderListener but I'm using annotated configuration, what to do?

I was using annotated configuration for my Spring web app and then had to mix XML with it so that I could use Spring Security. I annotated one of my configuration classes with @ImportResource("security-config.xml") to load the security config. The configuration beans are being created just fine. My web.xml looks like so: <?xml version="...

Can you mix and match Spring form tags and regular HTML form tags in a single HTML form?

I have a legacy HTML form that I want to make into a Spring form. Do I need to switch all of the form tags to Spring form tags or could I mix and match them as I please? In other words, something like this: <form:form modelAttribute="mymodel" action="/somecontroller/someaction" method="post"> <input type="text" name="something" value="...

Spring WebFlow: Problem recording in several stages with Spring WebFlow

Hi all, I realized the registration process into several steps of a user in a site with Spring WebFlow, but that does not work well. The Problem is, when the user being in the second form the button "return" (first form) clicks, all data from the first form, which have been entered disappear, ie are no longer there. Someone can have an...

How does formbackingobject and referencedata object operate in Spring Web MVC Cycle ?

Hi, I am new to Spring Framework and trying to understand the functionality of FormBackingObject and comparing it with referencedata object functions, both this objects confuse me when am trying to relate them to HTTP Request Cycle from Spring MVC point of view. I would really appreciate if someone can explain this two objects with r...

Spring Web Flow: FileUpload problem

Hi everyone, I want to save the uploaded file with Spring WebFlow in a specific folder, and I made the following. Here is the model: public class FileUploadHandler implements Action { private static final long serialVersionUID = -8801901733860111693L; static Logger LOG = Logger.getLogger(UserServiceImpl.class); private transient Mul...

Spring+JPA+Hibernate+Oracle insert query showing but data not inserting into DB

Help to solve this issue: Spring+JPA+Hibernate+Oracle insert query showing but data not inserting into DB : One to One relationship, here query for One table is showing second table insert query not showing, also data not inserting into DB. ...

Data binding of an abstract class in spring-mvc

I've went thru Spring documentation and source code and still haven't found answer to my question. I have these classes in my domain model and want to use them as backing form objects in spring-mvc. public abstract class Credentials { private Long id; .... } public class UserPasswordCredentials extends Credentials { private ...

BeanNotOfRequiredTypeException with Spring AOP

I am trying my hands at spring aop and below the spring config file: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/sche...

Spring, Jackson and Customization (e.g. CustomDeserializer)

Being still a little unfamiliar with Spring, I have encountered a problem that makes it necessary implementing my a custom deserialzer for Jackson. The procedure is described in a small tutorial, however, I am stuck with Spring. I do not understand, where ObjectMapper mapper = new ObjectMapper(); in Spring MVC is carried out when js...

Spring expression language not working with spring aop

<bean id="eddie" class="com.springinaction.Instrumentalist"> <property name="instrument" value="#{violin}"></property> <property name="song" value="#{kenny.song}"></property> </bean> <bean id="violin" class="com.springinaction.Violin"> </bean> <bean id="kenny" class="com.springinaction.Instrumentalist"> <property name="so...

Flex Blazeds Java NoSuchMethodException

Hi All We have a Flex-BlazeDS-Spring-JMS application. The issue is sometimes we get a Blazeds error: NoSuchMethodException. It is not able to find the Java service. The weird issue with this it does not happen all the item...1 time it goes through and returns the result, the 2nd time it fails, 3rd time fails and so on. Also not all meth...

Spring and Hibernate configuration

Here is my hibernate config, but for some reason it fails to load those properties that I have added to <property name="hibernateProperties"> and log says in startup that INFO org.hibernate.cfg.Environment - hibernate.properties not found. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"...

What's the difference between declaring a controller with the Spring Controller stereotype versus as a subclass of the AbstractController?

What's the difference between declaring the TestController with the Spring Controller stereotype like this: import org.springframework.stereotype.Controller; //... @Controller @RequestMapping("/test") public class TestController versus as a subclass of the AbstractController like this: import org.springframework.web.servlet.mvc.Abstr...

What does it mean to say "if (binding.hasErrors())" in Spring?

In this example, I don't understand what the BindingResult is for and what it means to say if (binding.hasErrors()) below. @RequestMapping(value = "/test", method = RequestMethod.POST) public final String submit(@ModelAttribute(TEST) @Valid final Test test, final BindingResult binding, final HttpServletRequest request, final ModelMa...