spring

Spring in Action 3 example of AOP causing problems

I am working my way through Spring in Action 3 and there is an example in there of using AOP with the around aspect. This is the Aspect class: package com.xetius.springIdol; import org.aspectj.lang.ProceedingJoinPoint; public class Audience { public void watchPerformance(ProceedingJoinPoint joinpoint) { try { System.out....

Task scheduling with Spring with cron data stored in entities

I would like to run cron tasks based on an entity, lets call that entity TaskEntity The TaskEntity can have info about what needs to be done (domain specific) and when. The when part can be specified in cron based manner Initially I thought of looking into Quartz but I could not find clear examples I am not sure how to proceed from he...

Spring security configuration using annotation configured beans

I'm attempting to configure spring security to use a service I implemented for authentication. My services and entity manager and all that are configured with annotations. I don't want to move all of the service, dao, and entity manager configuration into XML. How can I get the authentication-provider configuration to reference a serv...

Autowiring HibernateInterceptor as Advice

Hi folks, I am trying to use HibernateInterceptor as a Advice and I am trying to autowire it. The code is as follows, @Aspect public class InterceptorAdvice{ private HibernateInterceptor hibernateInterceptor; @Autowired public void setHibernateInterceptor(@Qualifier("hibernateInterceptor") HibernateInterceptor hiber...

JUnit : my XML file location in @ContextConfiguration isn't found

Hi, This is my JUnit class : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "WEB-INF/spring-test-config.xml"}) public class TestXXXX extends TestBase { ... When I launch this test class with JUnit runner (from Eclipse), it's failed, because the file spring-test-config.xml is not found. My project arc...

Spring configuration from database

We have an application which is deployed 120 times with slightly different configurations for each. We would like the configuration to be stored in the database for auditing and management purposes. How can you instantiate Spring beans directly from the database without using XML? Thanks ...

Spring's MockHttpServlet(Request|Response) alternatives?

In 'spring-test' there's mock classes for unit testing Servlets, which is very useful. Unfortuately, I do not need any of the other Spring componenets, and do not wish to depend on spring-core in my project. It is possible to either: Use spring-test without depending on spring-core, ... (i.e sever the mocking-classes from spring)? Us...

<h:selectBooleanCheckbox doesnt retrive values on Server

Hi, I am using JSF along with RichFaces and Spring Webflow. I am trying to select rows from the data table using and perform some operation on the server side on the selected row. How ever I am facing problem retrieving the data from the checkbox. <rich:column id="compCheckBox" styleClass="center-aligned-text"> ...

Make Spring replace placeholders in different file type (other than Spring's configs)

is there a way to make spring (v.3.0) parse placeholders in file that are not .properties? I know I can write my own PropertyPlaceholderConfigurer but I was looking for a "cleaner" way to do it. Thank you :) EDIT : To be realy clear, what I want to do is to replace placeholders that are in .sql files. So the values of the placeholders ...

Spring + Hibernate transaction takes 25 seconds doing nothing

I have a Java application using Spring + Hibernate. I have a pretty simple transaction that just recently started to take REALLY long to execute (~25 secs) though it's not making any obscure / complex queries, and according to the log, those 25 seconds are spent within Hiberante's code. The browser just hangs there waiting until it's don...

How to enable custom isolation levels for a JTA Transaction Manager in Spring

Question How do I configure a JtaTransactionManager object with allowCustomIsolationLevels set to true via Spring such that the Spring configuration can be used across multiple application servers? Background: I have an application that is currently running out of JBossAS and I'm trying to get it to run in WebSphere. The only issue I'...

@Transactional annotation doesn't work

ok, enough. I couldn't make this work. I am a newbie to Spring transactions and using the @Transactional annotation in my service to manage transactions. Below is my spring bean configuration file. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/X...

[Spring 3.0] Intercept-Url and filters

Hello everyone, I'm currently working with Spring 3.0.4 and Spring Security 3.0.2 (latest stable release at the moment). I'm kind of struggling migrating from Spring 2.5 to this new version, but that's a different subject. The real question is coming, inside the <http> tag you can put the <intercept-url>, but it seems like it can also ...

How can you have two URL routes mapped to the same handler method in Spring MVC (3.0)?

I have a a userPanel method mapped to the /user/panel URL route: @RequestMapping(value = "/user/panel", method = RequestMethod.GET) public final String userPanel(HttpServletRequest request, ModelMap model) However, I would also like the userPanel method to handle the route /panel without creating a separate method such as this: @Requ...

JSP/servlet read parameters from properties file?

My JSP pages need to display different information depending on which environment they're in (dev, production, sandbox, etc). I want to have a properties file for each of these environments that contain all the parameters they might need. How can I reference the properties from this file in a JSP page? My thoughts are: Have a servle...

Spring MVC security based on Session Attribute

I am using a Security scheme that is based on session attributes. I know that Spring has Acegi Security but I dont have much time to study that module. I just want to share this out to solicit comments from experts here. The pseudocode is like this. On successful Login, I am setting an attribute on user session. The object that I ...

Plain old singleton or spring singleton bean ?

I have a service in my application which is a singleton. My application is being bloated with the use of spring framework. I am confused over to use the singleton service as 1: Plain Old Singleton [Access them statically when required] OR as a 2: Spring singleton bean. [Use DI to inject when required] Which approach is correct ? ...

How to setup springpython with Jython and Eclipse/PyDev?

I'm having trouble setting up SpringPython with PyDev and Jython I've installed Spring python by: jython setup.py install and the setup installed the library to my jython installation successfully. See!: In my PyDev project i've selected the jython interpreter and have c:\jython2.5.1\Lib\site-packages in my Library paths: My ...

What's the default hibernate session control behavior in spring?

I have a 3 layer application using spring and hibernate (controller -> service -> dao) and transaction is applied to service layer. I don't configure OpenSessionInViewInterceptor or OpenSessionInViewFilter and I want to know the hibernate session control behavior. Open session per transaction or per request? Thanks! ...

classes qualify to be spring beans

In big enterprise projects which objects qualify to use as a spring bean and which are not ? The types of classes I can think of are requests, responses, services. helpers, registries, business objects, factories, validation rules, adapters and many more as per app requirements. Can all of them can be springified ? If everything is in...