spring

HibernateTransactionManager : possible to throw exception without rollback ?

In Spring, I have declared a method to be transactional. I use HibernateTransactionManager. Now, I would like to throw an exception from this method, but I do not want hibernate to rollback the transaction. Is it possible to specify wich exceptions cause the rollback ? ...

Spring MVC very confused about controller mappings

Using annotation-based controller mappings. @Controller public class AlertsController { @RequestMapping(value="create", method=RequestMethod.GET) public void create(HttpServletRequest request, Model model) { } } When access alerts/create, I get the message Does your handler implement a supported interface like Controller?. Thi...

How to configure Apache FtpServer?

I found this very simple description on Apache FtpServer's document: Integration with Spring Framework Apache FtpServer uses Spring Framework to implement the configuration. That also means that we get the added benefit of full integration with regular Spring XML configuration. For example, you can embed the "server" element whe...

Accessing Spring bean *not* by dependency injection

We have some domain objects that are created at runtime - not by Spring. These domain objects need access to some service type beans that are being managed by Spring. How can the domain objects that are created at runtime access Spring beans dynamically (not by DI)? ...

Using spring beans from other modules?

I imagine this is simple - but I can't find the right combination of search terms to get an answer. If I have a multi-module application, how do I get the beans in module A available to the beans in module B. The project setup looks a little like this: project.ear/module-a.jar/resources/beans.xml project.ear/module-a.jar/java/foo/bar.c...

In a spring messages.properties, how to ensure line break of error message when using an error code as key ?

In messages.properties: error.code=This is error message.\nThis is next line of error message. Now, when I set "errors.rejectValue" with this "error.code" for a form field, I cannot get the line break of '\n' to display on the jsp page when displaying the error message using the form:errors element. Instead of '\n', using <br/> also ...

Java Web-Application deployment and initialization

Hi all, i'm developing a web-application for managing and sharing images and more general media-types at all. My technology stack is: Java 6 Spring 2.5x JPA 1.0 JCR 1.0 with Jackrabbit 1.6.x ACID-able DB like Derby oder MySQL with InnoDB Porting to Spring 3.0, JPA 2.0 and JCR 2.0 is in the queue During deployment i have to provide ...

Using Resteasy with javassist?

I'm trying to use resteasy to serve out some entities fetched by spring-hibernate. I've configured one method which returns a POJO and works as expected: @GET @Path("/test") @Produces(MediaType.APPLICATION_XML) public Episode getTestEpisode() { Episode e = new Episode(); e.setEpisodename("test"); return e; } Produces: <episod...

Creation of generic type using Spring Config

How can I instantiate a bean with generic type using spring config public class GenericService<T> { ... } Note that T is not the concrete type of a bean property. It is really just the type for one of the methods of the service. In other words.. Can I instantiate new GenericService of type String() or new GenericService of type ...

Hibernate Spring Transactions

Hi there, I'm trying to get my spring DAOs to work but I only get this exception PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'sessionFactory' threw exception; nested exception is org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation...

Distributed Application Environment and Web Services - What/How to learn?

I want to learn how to create distributed application environments and web services using spring, aspectj, hibernate, etc. rather than EJBs. Can anyone recommend a book or set of books that can help me (a single all-in-one book would be preferable)? Also, any advice regarding learning/creating distributed app environments and web serv...

Spring best practice for locking domain objects?

Using EJB entity beans you can configure the bean so that when a thread has access to an EJB entity bean, no other threads can access the EJB bean. The container will block other threads until the thread with the lock is finished with the bean. Is there a "Spring way" to do this? Or do you have to just use the standard Java concurrenc...

When is Spring + Tomcat not powerful enough?

I've been reading/learning more about Spring lately, and how one would use Spring in combination with other open-source tools like Tomcat and Hibernate. I'm evaluating whether or not Spring MVC could be a possible replacement technology for the project I work on, which uses WebLogic and a LOT of custom-rolled J2EE code. The thing is, I'v...

Is it possible to bind a Spring Form to an Object using the constructor or by mapping multiple fields to a single value via a custom Editor?

I have an Object who's internal representation is not conducive to data entry. I have a class with multiple custom components, one of which is a Range class. The Range class is easiest to input using two text field inputs rather than as one text field that uses a custom PropertyEditor. I have a fully functional constructor that could ...

hibernatetemplate clear ehcache?

<ehcache> <cache name="query.ContactInfoList" maxElementsInMemory="200" eternal="true" overflowToDisk="false" timeToIdleSeconds="300" timeToLiveSeconds="600" /> </ehcache> public List getContactInfoList(){ hibernateTemplate.setCacheQueries(true); hibernateTemplate.setQueryCacheRegi...

Enabling global transactions on WAS for MQ + JDBC data sources

Can someone help me with the settings required for enabling global transactions on a queue listener and data source. I am able to achieve it with database, but my listeners stop working I am using following configuration for it: <tx:jta-transaction-manager/> <jms:listener-container connection-factory="jmsConnectionFactory" transaction-...

Is there something like asynchronous caching with ehcache and springmodules?

Is it possible to have cached queries asynchronous, so that no frontend user actually has to wait for a heavy query to finish? (I.e. heavy query is running as background thread, while (expired) data is delivered from cache. Use case: A web page displaying data, needing some time (too long to wait for when requesting a page) to be collec...

Spring Web Flow form binding

Hi. I have a java web app running in spring web flow framework and hibernate as ORM. I wanna ask what the best practice is with regards to binding the form values. Do I create a pojo or bean representing each form so that I have an object where I can bind the form to? I can try getting the values as parameters in the url but I don't thi...

Getting access to a spring bean from a webservice?

I have created a cxf webservice within my cxf.xml file I have the following tag. bean id="videoStatsTable" class="com.company.auth.dataobjects.VideoStatsTable" From what I understand Spring should create this object for me. The problem is I'm not sure how to get access to it. It seems as if I need the servletContext but as I'm in not i...

Registering a shutdown hook in Spring 2.5

I have a spring application which is not calling bean destroy methods on shutdown. I've seen references to this being due to instantiation in a beanRefFactory, and that this can be circumvented through manually calling registerShutdownHook() on an the application context.This method seems to have disappeared from spring between versions ...