spring

Can the Spring Framework be used for batch applications?

My company is switching to Spring for our Java framework, and from what I understand it will work well for that, but we also have many Java batch applications*. Does Spring have adequate support for running batch applications? What features of spring will be useful in this environment, and won't work at all? * Java command line progra...

How to automatically create and inject a proxy of a missing dependency?

Given the following classes: package com.acme; public class Foo { private Bar bar; public void setBar(Bar newBar) { this.bar = newBar; } } @AcmeService public interface Bar {} and a Spring configuration file of: <beans> <bean id="foo" class="com.acme.Foo"> <property name="bar" ref="bar" /> </bean> </beans> when ...

How does Spring maintain singletons,prototypes... under the hood?

I've been using Spring for a while now but I really don't know how when I ask Spring to inject a DAO in multiple different service class that it is always the same class or if I require prototype is a new one every time and so on for session scope etc. Can anyone share some light on such especially 'Singletons' as it is the most often us...

How to specify a parameter as part of every web service call?

Currently, each web service for our application has a user parameter that is added for every method. For example: @WebService public interface FooWebService { @WebMethod public Foo getFoo(@WebParam(name="alwaysHere",header=true,partName="alwaysHere") String user, @WebParam(name="fooId") Long fooId); @WebMethod public Result d...

spring @autowired

to use @autowired. in xml, i only need to included <context:annotation-config /> ? is there any other tag i need to put ? need to put componenet-scan ? weird, i get error below ERROR - ContextLoader.initWebApplicationContext(203) | Context initialization fa iled org.springframework.beans.factory.BeanCreationException: Error creat...

Choosing between Impala and OSGi

I've been investigating OSGi for my company's software, but have recently been recommended to take a look at Impala. According to its web page, Impala is "a dynamic module framework for Java-based web applications, based on the Spring Framework." At a glance, and looking at this blog post about the differences, the key differences I can...

Spring3/Hibernate3/TestNG: some tests give LazyInitializationException, some don't

Dear Sirs, The preface: I'm struggeling with LazyInitializationException in my Unit Tests, and I have a really hard time getting my head around it, as you can see from my questions Database Sessions in Spring, TestNG and Spring 3 and LazyInitializationException while unit-testing Hibernate entity classes for use in Spring, using TestNG...

Problem creating bean of sessionFactory in spring-hibernate configuration

Hello, I am using spring and hibernate for configuration with mysql db. My we.xml file has following code : <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun....

Spring security - SecurityContext.authentication null in taglib and jsp but ok in controller

Hi all, I've been struggling with this issue for a little while now. Found several posts about it but none solved my problem. It will probably have something to do with the fact that a SecurityContext is boud to a specific Thread but even then I do not know how to solve it: Consider following code to retrieve the user that was logged i...

DAO, Spring, Hibernate, Jboss

How exactly are these 4 components related, any good explanations someone can offer or links or whatever useful. ...

In JPA and Spring can a persistence unit be created on the fly?

So apparently we have the need to create persistence units on the fly. Basically we have this web service and a bunch of identical schemas with identical domain classes. We want to be able to pass a query to the web service where the context path matches a schema. The first time that the service is queried then pass in that schema name a...

Getting error when submitting form using SpringMVC and REST

Hello there, Created an online form in JSP using SpringMVC tag libraries. The controller for my form is a RESTful web service. The RESTful web service has two calls: (1) http://localhost:8080/myapp/applications/new This brings up the online form in the browser (this works). (2) http://localhost:8080/myapp/applications/create This ...

SOAP and Spring

Hi guys, I've just finished reading about SOAP via Spring-WS in "Spring in Action", 2nd edition, by Craig Walls from Manning Publications Co. They write about Contract First, much like the Spring docs, with making a message and method XML and then transforming that to XSD and then again to WSDL, while wiring up the marshalling and servi...

Spring Application Context available inside the constructor

Hi, I am having an issue when trying to create beans from a spring Application Context inside a bean instatiated by sptring using constructor arguments. I have implemented the ApplicationContextAware interface but it populates the context after the instance is created (obvious). But then, if you need to get beans from the constructor...

Two EntityManagerFactories...

I want to have two EntityManagerFactories (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in this case), with each of them having their own data source and own set of persistent objects. So somehow I need to be able to scope entities to a particular entity manager factory. I would prefer not to have to hard code the ...

Spring Explorer not showing beans from bean definition file

I just downloaded the Springsource Tool Suite, and I created a simple bean configuration file called myDefinition.xml and placed it in the root directory of the Spring Project. However, the Spring Explorer is not showing any data. I'm using eclipse 3.5 and the latest SpringSource all-in-one installation. Also, if I specify invalid prope...

Loading Spring Context Dynamically at Run-time in a Web Application.

Hello Everyone, I'm converting a standard Java Application that uses Spring Framework into a Web App. This application loads new Spring Context based on run-time parameters, that was done using ClassPathXmlApplicationContext/FileSystemXmlApplicationContext. So my question is how to do the same in a Web Application given that I already...

How can I access path variables in a URI template in the view (Spring 3/SpringMVC)?

I have a URI template in the form of "/hotels/{hotel}/bookings/{booking}", and can access the path variables in the controller via @PathVariable, but when building links in the view I need a reference to the different path variables. As an example, let's say the user requests "/hotels/123/bookings/booking-123", and in the view, there ...

weird grails error message.

Hi, Using grails 1.1.1 I got this message when I did a modification on a service and then tried to refresh the page. I have a controller name ContributionPlanController. It has a service ContributionPlanservice. inside the ContributionPlanService, it has ProductService and some other Services including JointPIAService. JointPIAServi...

Spring @Transactional merge and persist question

Hi, new to Spring and here @stackoverflow I'm building an stand-alone Inventory & Sales tracking app (Apache Pivot/Spring/JPA/Hibernate/MySQL) for a distributor business. So far I think everything is CRUD, so I plan to have a base class with everything @Transactional. Then I got a problem with my save generic method. Does persist and ...