spring

Mapping both static and dynamic files in Tomcat/Spring?

I was using the following in web.xml to configure a servlet to dynamically generate PDFs. <servlet-mapping> <servlet-name>pdfServlet</servlet-name> <url-pattern>*.pdf</url-pattern> </servlet-mapping> Now, I also have to serve a few static PDF files. What's the cleanest way to configure that? I'm currently only serving four o...

Spring WS and PayloadRootAnnotationMethodEndpointMapping

I have two endpoints using annotations. I want to apply different interceptors to each of them. (one being a secure interceptor and the other not being secure) Is there a way to do this using PayloadRootAnnotationMethodEndpointMapping? Anyone have an idea? According to the applicationContext-ws.xml of the airline example that comes with...

Spring 3 JSON with MVC

Is there a way to build Spring Web calls that consume and produce application/json formatted requests and responses respectively? Maybe this isn't Spring MVC, I'm not sure. I'm looking for Spring libraries that behave in a similar fashion to Jersey/JSON. The best case would be if there was an annotation that I could add to the Contro...

Java, Spring - Logging Bean Properties

Say I have the following bean definition: <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="driverClassName" v...

spring: set property of one bean by reading the property of another bean?

Is it possible to set the property of one bean by reading the property of another bean? For instance, suppose I had: class A { void setList(List list); } class B { List getList(); } I would like Spring to instantiate both classes, and call A's setList method, passing in the result of calling B's getList method. The Spring confi...

How to implement the Strategy Pattern in AOP

Can anyone tell me how to implement the Strategy Pattern in AOP? An example using Spring-AOP or AspectJ would be very helpful. ...

No Hibernate Session bound to thread

I'm using Struts + Hibernate + Spring for my project development. And here is my Spring Context XML file. When I called "sessionFactory.getCurrentSession()" in the beginning of userDao.getXXXX method, the exception whose detail message is "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactiona...

Spring JSON View: ApplicationObjectSupport does not run in an ApplicationContext

I'm trying to use a Json View for Spring (http://spring-json.sourceforge.net/) (org.springframework.web.servlet.view.json.JsonView) but whenever I write a controller class that extends AbstractController I get the following Error: java.lang.IllegalStateException: ApplicationObjectSupport instance [org.springframework.web.servlet.view.js...

Executing a method from another class in Java... and more

Hiya all, I have a method that returns a list of items called findItemByPIdEndDate() and its found inside MngtImpl.java class. Now I'd like to execute this method every once in a while, hourly lets say so here is what I did so far : This is CronSchedule.java import org.quartz.CronTrigger; import org.quartz.Scheduler; import org.quartz...

AOP with AbstractAction execute method

I was attempting to set up an aspect on one of the classes extending AbstractAction (SWF - package org.springframework.webflow.action) on the public final method execute. The execute is the only public method in the interface Action class It's signature is: public abstract Event execute(RequestContext requestcontext) throws Exception...

Spring AOP vs AspectJ

I am under the impression that Spring-AOP is best used for application specific tasks such as security, logging, transactions, etc. as it uses custom Java5 annotations as a framework. However, AspectJ seems to be more friendly design-patterns wise. Can anyone highlight the various pros and cons of using Spring-AOP vs AspectJ in a sprin...

How to execute method using spring beans

I need findItemByPIdEndDate() method of the MngtImpl class to be invoked every 5000ms, but nothing appears to be happening. Am I missing something? <bean id="findItemByPIdEndDate" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="MngtImpl"/> <property name="targetMet...

How to define XSD for spring-ws contract to return a serialized image?

I'm trying to put together a contract-first web application using Spring-WS. I want to define an operation that the client can invoke by providing no parameters and simply get back from the server an Image that it can draw on the screen. My guess for how to do this is to define an ImageRequest XML snippet, such as: <ImageRequest xmlns...

Spring view resolution problem

Spring, Spring MVC 2.5, Tomcat 6.0. In my controller: ModelAndView returnModelAndView = new ModelAndView(new InternalViewResolver("/sandbox/test1.jsp")) Was working. Then I switched the Tomcat (6.0) context path from "/appname" to "" in order to reference the webapp from the root context "http://localhost:8080/". All my filter, intercep...

Howcan I get started with Spring Batch?

I'm trying to learn Spring Batch, but the startup guide is very confusing. Comments like You can get a pretty good idea about how to set up a job by examining the unit tests in the org.springframework.batch.sample package (in src/main/java) and the configuration in src/main/resources/jobs. aren't exactly helpful. Also...

Why Spring Framework ?

I hear now a days alot about Spring Framework ? Why there is soo much buzz around Spring Framework in Industry ? ...

Best way to Learn Spring Framework

What are the best books/tutorials/online sites/resources or blogs to learn Spring Framework ? ...

Spring + Thread safe singletons

I'm working on a project where we use MULE and Spring. In the context we create beans that provide the services. All the beans are essentially thread safe singletons. Is this a popular/recommended way of writing services? ...

Concurrency issues in Spring DAOs with 3.0.0.RC1

Hi guys, After upgrading from Spring 3.0.0.M4 to 3.0.0.RC1 and Spring Security 3.0.0.M2 to 3.0.0.RC1, I've had to use a security:authentication-manager tag instead of defining an _authenticationManager like I used to in M4/M2. I've done my best at defining it, and ended up with this: <security:authentication-manager alias="authenticati...

jBPM + Spring transactions sharing and scope

Hi all. I've inherited an app using jBPM and Spring and am trying to figure out if it is configured the way it should be. First question: Does jBPM span a single JTA (JDBC and/or Hibernate) transaction across multiple actions in the same transition by default? If not, can it be configured to? So in the example below is there a way to sp...