spring

What is the best Java RESTful framework for a very simple backend server?

I need to develop a very thin shim for hadoop to be used together with Rails/Sinatra application. I'm a .Net developer and have a lot experience with Ruby. So what is the best framework to choose giving the fact it is needed for a very small project and it should provide RESTful web services. I looked at Grails and it seems to be very r...

How does autowiring work in spring?

I'm a little confused as to how the IOC works in spring. Say I have a service class called UserServiceImpl that implements UserService interface. How would this be auto-wired? And in my Controllers action, how would I instantiate an instance of this service? Would I just do: UserService userService = new UserServiceImpl(); ...

Getting 'Named query not found' with Spring framework

I have a Java class (Entity) with a set of named queries. When the Spring tries to inject the related bean, it is not finding one of the queries. As example: @NamedQueries({ @NamedQuery(name = "Query1", query = "..."), @NamedQuery(name = "Query2", query = "..."), @NamedQuery(name = "Query3", query = "..."), ...

How to specify the default scope in Spring's applicationContext.xml to request scope?

I want to make all beans request scoped by default, however the Spring documentation says that the default scope is Singleton. (sections 3.4.1 and 3.4.2 http://static.springsource.org/spring/docs/2.5.x/reference/beans.html) I want to declare the default scope to be request scoped. This is the closest thing I have found so far -- it's ...

spring basic mvc sample application, annotation scan confusion

Little confused, the basic spring mvc app has this: app-config.xml <context:component-scan base-package="org.springframework.samples.mvc.basic" /> and the mvc-config.xml has: <!-- Configures the @Controller programming model --> <mvc:annotation-driven /> Do you really need both? for component-scan, does this mean if I don't p...

how to use messages with freemarker in spring mvc?

In a .jsp I would use: <fmt:message key="welcome.title"/> to display a message from my messages.properties file. How would I do this with freemarker ? ...

spring scope request bean is resolved to be null

hi all . I'm new to spring, currently i use the request scope and get the following exceptions: javax.el.PropertyNotFoundException: /login/login.xhtml @11,86 action="#{loginViListWeb.nextPage}": Target Unreachable, identifier 'loginViListWeb' resolved to null the part of the .xhtml is: <h:outputText value="#{loginViListWeb.empName}"/...

header and footer and freemarker

My website has a consistant header and footer that I want on all pages. What is the best way to do this? The header will have some dynamic data also, based on the current view. P.S Does freemarker have any sort of master page functionality? Where I can create a base template, then have other templates build upon the base? Basically ...

Spring Test's @BeforeTransaction is still inside a transaction?

I'm using Spring Test and JUnit to run DAO integration tests. The test class is annotated as follows: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( { "/testPersist-applicationContext.xml" }) @Transactional I use the @BeforeTransaction annotation on a method to insert some test data -- that I would expect to be there ...

How to programmatically get transaction manager in a thread ?

I have a wicket page , which contains two Spring-managed beans , one is DAO , another is Service Object : public class MergeAccountsPage extends WebPage { @SpringBean private MergeEmailDao mergeEmailDao; @SpringBean private MergingService mergingService; } The MergingService's implementation's methods are mostly annotated wit...

Spring 3.0 RESTful Controller Fails on Redirect

I am setting up a simple RESTful controller for a Todo resource with an XML representation. It all works great - until I try to redirect. For example, when I POST a new Todo and attempt to redirect to its new URL (for example /todos/5, I get the following error: Error 500 Unable to locate object to be marshalled in model: {} I do know...

What is the model key for an Errors object in Spring MVC?

In my Spring MVC based web-app, I'm manually creating an Errors/BindingResult object after manually validating one of my domain objects. I can add my domain object into the Model by doing the obvious: model.addAttribute("myObject", myObject); After I do validation and have created an Errors/BindingResult object, under which key should...

JMS - can anybody give a reference on JMS

Hi, Im doing a JMS project. can anybody point out a reference on running ActiveMQ(JMS) on two different pc using eclipse on both pc? tnx -jaded ...

Unit testing with Spring framework singleton beans

It’s a general consensus that Singleton is bad for unit-testing. But what about having an IoC container like the Spring framework to control your beans which are singletons by default? Is using those beans in your classes also considered bad for unit testing the same way singleton is? ...

How can I simulate the ending of a transaction using JUnit with Spring and Hibernate to isolate a LazyInitializationException?

I'm trying to write a test that isolates the failure to load a property because no Session exists. The following path fails ERROR [http-8081-14] LazyInitializationException.setSessionAttribute(223) | could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hib...

StaleObjectstateException row was updated or deleted by ...

I am getting this exception in a controller of a web application based on spring framework using hibernate. I have tried many ways to counter this but could not resolve it. In the controller's method, handleRequestInternal, there are calls made to the database mainly for 'read', unless its a submit action. I have been using, Spring's S...

Why does eclipse not find the beans.xml files in a spring based Maven project

I have a maven project under eclipse with m2eclipse. WHen running integration tests the tests fail with the mention that the spring configuration files cannot be found on the classpath, and I get a similar error from log4j. I was under the impression that m2eclipse would add the resources directories to the classpath but apparently no...

How to make a SimpleFormController show a form using HTTPS

How is this done? I have a view which in certain conditions I need to display using HTTP and in other cases HTTPS. The controller is using SimpleFormController. ...

Reserve Port in WebSphere

I am using Spring with WebSphere 6.1 and today I started to get NET_BIND errors stating that port 1099 (port that Spring is using) is already in use and that Spring cannot use it. I've been using that port for a long time and ran netat to make sure that 1099 wasn't listed (which it wasn't). I also looked at the ports configured for my ...

What beans do you wire in a spring mvc app?

I am wiring my UserService type classes using spring's IOC. But what about my User class? I have a interface User, then a UserImpl class. In my controller action's do I just do: User u = new UserImpl(); Or would it sometimes make sense to use IOC for this also? Sometimes I use a different constructor also when instantiating a cla...