spring

How do I get the size of a response from a Spring 2.5 HTTP remoting call?

I've been poking around the org.springframework.remoting.httpinvoker package in Spring 2.5 trying to find a way to get visibility into the size of the response, but I keep going around in circles. Via another question I saw here, I think what I want to do is get a handle on the InputStream that represents the response from the server, ...

How to get the default WebApplicationContext ?

I need the context to ApplicationContext.xml ,which I provided in web.xml as <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> But I need a control for this in Controller class. I tried many things including WebApplicationContext ctx = ContextLoader.get...

Get path to directory from Spring bean?

I have what seems like a simple problem. I have a Spring web app, deployed in Tomcat. In a service class I want to be able to write a new file to a directory called graphs just under my application root: / /WEB-INF /graphs/ /css/ /javascript/ My service class is a Spring bean, but I don't have direct access to ServletCon...

quartz throws deadlocks under load

We are using Quartz with Spring and our configuration is throwing deadlocks when quartz has more than 1 thread configured. I'm starting to believe that it's because we don't have our quartz configured correctly with Spring, but I can't find enough documentation on how to configure the two to play nicely. We are running on both Windows a...

What should the Java main method be for a standalone application (for Spring JMS) ?

I am interested in creating a Spring standalone application that will run and wait to receive messages from an ActiveMQ queue using Spring JMS. I have searched a lot of places and cannot find a consistent way of implementing the main method for such a standalone application. There appears to be few examples of Spring standalone applicati...

What should I do in order to be able to work with maven + eclipse + wicket + hibernate + spring in Mac OS?

I want to create a web app that will use wicket, hibernate and spring frameworks. My IDE of choice is Eclipse, I am using maven for the .war generation and I am running Mac OS. What steps should I follow to correctly install and configure all the tools so as to have a project running that relies on these 3 frameworks. I was able to succe...

Database backed clustered Quartz jobs - Are dynamicly created triggers automatically clustered?

Our use of Quartz so far has been to configure the database backed scheduler and any jobs/triggers in the spring config which is then loaded when the app is run on the cluster. Each server in the cluster then shares the triggers so that the triggers are only run by one of the servers each time. I now want to dynamically create new trigg...

JEE6 vs. Spring 3 stack

I'm starting a new project now. I have to choose technologies. I need something light, so no EJB or Seam. On the other hand I need JPA (Hibernate or alternative) and JSF with IceFaces. Do you think that such a stack on Spring 3 deployed on Tomcat is a good choice? Or a JEE6 web application could be better? I'm afraid that JEE6 is a new t...

Reading annotation property in aspect

How to read annotation property value in aspect? I want my Around advice to be executed for all joint points annotated with @Transactional(readonly=false). @Around("execution(* com.mycompany.services.*.*(..)) " + "&& @annotation(org.springframework.transaction.annotation.Transactional)") public Object myMethod(ProceedingJoinPoint pjp) ...

Accessing beans in portlet specific context programmatically

Hi, I have a portlet application. It is configured using Spring framework IoC container. I am using org.springframework.web.context.ContextLoaderListener to load my context. I have an application context at root level (applicationContext.xml) and a portlet specific context (MyPortlet-portlet.xml). I have a portlet of type org.spring...

Question about spring manning-in-action

I saw people asking about best book for learning spring, and I came across manning.spring in action was recommended most of the time so I decided to give it a go. The thing is the author offers some pretty reasonable explanations, puzzle by puzzle it gets in your head, than you just need to code it and you're done, you get it(this is h...

Spring Transaction Manager

Hi. I have a j2ee application running on spring framework. I am implementing a transaction manager with AOP. It works fine. When an exception occurs in my method it is detected by my AOP configuration and rolls back the changes in the DB. But the problem is the code where you expect the error should not be surrounded with try-catch. When...

How does one instantiate Spring in the context of a library?

I'm looking for an example which shows how to instantiate a Spring container within the context of a set of classes packaged in a plain old, non-executable java library/JAR. The core purpose here is provide dependency injection (primarily for logging) The fundamental problem as I see it is that a non-executable jar has no single startup...

Ant replace properties

Hi. I've replaced properties file for Spring ApplicationContext using Ant, properties replaced correctly, and immidiately after Ant taskCalled, only after that first ApplicationContext call will be, but application context gets old property values ...

Exclude LOG4J Database Logging from AOP Transaction Rollback

Hi. I have a j2ee web application running on Spring framework. It uses Log4j for logging and Spring's AOP and Spring's transaction manager (e.g DataSourceTransactionManager) for roll-bakc during exceptions. I believe the best way to put log errors or exceptions is on the catch. So assuming I put the logging here and rethrow or bubble-up...

Spring Transactional Parameterized Test and Autowiring

Is there a way to get a class that extends AbstractTransactionalJUnit4SpringContexts to play nicely with JUnit's own @RunWith(Parameterized.class), so that fields marked as Autowired get wired in properly? @RunWith(Parameterized.class) public class Foo extends AbstractTransactionalJUnit4SpringContextTests { @Autowired private Bar b...

How can I use Spring Security without sessions?

I am building a web application with Spring Security that will live on Amazon EC2 and use Amazon's Elastic Load Balancers. Unfortunately, ELB does not support sticky sessions, so I need to ensure my application works properly without sessions. So far, I have setup RememberMeServices to assign a token via a cookie, and this works fine, b...

Which JAR contains org.springframework.orm.hibernate.HibernateTransactionManager?

Hi I am trying to use Hibernate+Spring in my application but stuck into following error: java.lang.ClassNotFoundException: org.springframework.orm.hibernate.HibernateTransactionManager Tired of googling, could any stackoverflower tell me which JAR contains the above class? EDIT An important thing that I did not notice was that Spri...

How can i inject servletcontext in spring

I need to write a junit test for a rather complex application which runs in a tomcat. I wrote a class which builds up my spring context. private static ApplicationContext springContext = null; springContext = new ClassPathXmlApplicationContext( new String[] {"beans"....}); In the application there i...

Create ObjectPool in Spring

I have a class class ObjPool { MyObject getObject() {...} void returnObject() {...} int getUsedCount() {...} } How can we use Spring framework so that it would provide only one copy of this factory to all (web) applications and so that each and every application use the same ObjPool? I mean if app A gets an object from this ObjPo...