spring

get File from JAR

Hi, I'm using Spring's Resource abstraction to work with resources (files) in the filesystem. One of the resources is a file inside a JAR file. According to the following code, it appears the reference is valid ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); // The path to the resource from the ro...

How do I determine stale session versus no session in Java

Hi We have a site where the user gets a navigation bar to allow navigation of search results. When the user goes away for lunch or whatever, and the session times out, clicking next in the navigation which is still on the screen will show the next page, but will then lose the navigation since it was stored in the now stale session. Thi...

Is it possible to define a dependency between two beans in Spring outside of the definition of the two beans?

I use the depends-on attribute in our production system to control the shutdown order of the beans. Thus, Bean1 doesn't have a compile-time dependency on Bean2, but it should be shutdown first to ensure correct operation. I'd like to test Bean1 in isolation by injecting it into my unit tests. Because Bean2 isn't part of the test, I don't...

spring bean should be sington is Good for Project ?

Why we are putting bean as signlton? there is no any concurrency issue occur ? How we prevent ...

How to log JDBC connection info on org.springframework.jdbc.CannotGetJdbcConnectionException

I'm working on an application which uses the Spring framework in combination with Ibatis and a C3P0 Connection pool. The system connects to about 12 seperate databases. When one of the databases is unreachable, I get a stacktrace in the logfile which is generated by Spring (see below). However, this logging is missing very vital informa...

Can i use Spring's @RequestMapping and BeanNameUrlHandlerMapping in conjuntion with each other to map a URL to method?

What I would like to do is have a common Service class which has various methods such as "search" "retriveByID" etc. Ideally this class would consume the service parameters and populate a request object and hand off to the appropriate data source handler. I want to instantiated a service class as a Spring bean with different request h...

Unable to read TLD "META-INF/c.tld"

Hi everyone... there's this issue with JSTL I'm stuck with for the past couple of days. Any help is appreciated. Tomcat: 6.0.28 Eclipse: Helios pom.xml : <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> ...

Creating a custom login form with Spring Security

I'm trying to get the custom login form to work with Spring Security 3.0. The default login form works fine with the security configuration below. Then I added the form-login attribute, created the login controller and jsp page to handle the /accounts/logIn URL and now have this problem: when I enter my guest/guest credentials, I am s...

Hibernate updates database though all the service methods marked as read-only by spring transaction management

I have already posted this question before but as the thread is little old I think I am not getting reply so sorry for duplicating but my issue is something related to spring transaction. I am facing a similiar problem with Spring Transaction management. I am using hibernate as ORM framework. And below is the excerpt of spring configura...

i am using spring+hibernate and i m getting error : org.springframework.dao.InvalidDataAccessResourceUsageException

i am using spring+hibernate and i m getting error when i upload doc file using rich:upload component, doc is uploaded sucessfully but when i click ok it gives following error. The field is byte[] doc; org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert: [com.eTender.model.UploadDoc]; nested excepti...

Persistence with Vaadin

Hi I'm trying to learn vaadin. I'm really confused how to do any kind of application development with persistence because if I have a reference to my service layer objects, they get stored in session and I really don't want that. Persistence stuff just isn't serializable. My case is that I have an already made application that uses Spr...

[Flex][GraniteDS] Flex side error : Didn't receive an acknowledge message

Hi all, I've this error when I try to load a list of "Product" in a simple DataGrid : Didn't receive an acknowledge message Was expecting mx.messaging.messages.AcknowledgeMessage, but received null After several tests I'm pretty sure now that it's a mapping issue, and as I'm not used to annotations, maybe it comes from here, here are...

Lazy loading problem in Spring/Hibernate/Richfaces application

Hello In a Spring application, I use the component rich: tree with Hibernate which display the hierarchy of applications using lazy loading. The problem is that the Hibernate session is closed which prevent lazy loading and i receive exception when the page is rendered. Finally I added opensessionViewFilter that's allows me to keep the s...

In grails, what is the quickest way to obtain a reference to the current hibernate session?

I got a singleton service and inside its only method I need to obtain a reference to the hibernate session bound to the current request. What is the quickest way of doing that? ...

How to set a regex string with spring without it being escaped?

I'm using spring for setting my regular expression spring: <property name="regularExpressionAsString" value="(?&lt;!\\.TMP)\\Z" /> code: public void setRegularExpressionAsString(String regularEx) { this.regularExpression = Pattern.compile(regularEx); } This doesn't work properly and when I debug my setter I've seen that spring...

Spring framework self-training

I'd like to learn Spring MVC framework basis. My personal experience tells clearly that more than reading manuals, docs, howtos only is only one important part of self-training, but to capitalize real experience you need to solve real problems. May someone suggest a fake-project that I can implement in my free-time, avoiding only-theoret...

How to delay spring beans startup?

Having spring application (actually grails app) that runs apache-activemq server as spring bean and couple of apache-camel routes. Application use hibernate to work with database. The problem is simple. Activemq+Camel starts up BEFORE grails injects special methods into hibernate domain objects (actually save/update methods etc). So, if ...

Spring JMX - exporting a map of key value pairs

Is it possible, ideally using the spring JMX annotations, to export a map of key value pairs where the key is used as the exported attribute name? If so, how? Thx. ...

Spring MVC 3.0: Is String the preferred type to be used for @PathVariable?

Pardon me for asking such a simple question here as I'm new to Spring MVC 3.0. I have been reading the documentation from spring source website a few times. Here's a code snippet that I'll refer to for my question below:- @RequestMapping("/pets/{petId}") public void findPet(@PathVariable String petId, Model model) { // implementatio...

Problems with HibernateTemplate.find() and Lazy Loading in Spring/Struts

Hello! I've been trying to work with OpenSessionInViewFilter and having some limited success, but my problem comes when trying to lazy load objects that are returned using the getHibernateTemplate().find() call. I'll be using my "Slot" class as an example, but this is happening with anywhere that I'm trying to use "find()" to return a ...