spring

SpringJunit4ClassRunner -- can I change the lifetime of the injected resources?

By experiment, I find that SpringJunit4ClassRunner treats the context and its beans as 'class scope' in the JUnit sense of scope. It inititializes my beans once for the entire set of tests in the class. Is there any way to use this mechanism and get these things to be 'test scope'? In short, I wish that the context was being loaded as @...

Spring schemaLocation fails when there is no internet connection

Hi I am using Spring and at application-context.xml file; i have definations like : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springfram...

What are the available options to retrieve Spring-managed beans in a Log4J Appender inside a Spring-managed web application?

Hello. My current build lead has a great idea in theory - construct a custom Log4J appender that takes in Spring-managed beans and uses them to log errors to various other sources than just the standard log file. However, other than creating a singleton initialized at startup with the application context (code in just a moment), I can'...

Which is better to continue Java EE or Spring Framework?

I am not so much experienced on enterprise systems but i have some experience on Spring framework.I start to think open source framework such as Spring,Hibernate start to become defacto in enterprise development.Do you think it is necessary to learn Java EE 6 to become experienced on enterprise development cause i do not have so much exp...

Spring applicationcontext loading hooks

Are there any hooks into the Spring ApplicationContext loading process? I want to run a piece of code just before the application context loads (before any beans/properties/aspects/etc... are instantiated). thanks in advance ...

Using spring3 @Value to access PropertyPlaceholderConfigurer values ?

I'm trying to set the value of a string in a spring bean using @Value, when my property source is a subclass of PropertyPlaceholderConfigurer. Anyone know how to do this ? ...

Hibernate + Spring + persist one-to-one relation + empty foreign key

Hello, I am trying to persist a one-to-one relation with Spring 1.2.8 and Hibernate 3.2.7ga but the foreign key is always empty. But let me first give you a short introduction: I have two Entities called "ClientDomain" (Web-Domain) and "Measurement". Hibernate Mapping Files: ClientDomain.hbm.xml: <hibernate-mapping package="statist...

Spring: Singleton/session scopes and concurrency

Does singleton/session scopes of Spring beans require that access to all its fields must be synchronized? Say through "synchronized" keyword or using some classes from package "java.util.concurrent". As example, is this code not thread safe? (copy/pased from here): @Component @SessionScoped public class ShoppingCart { private List<...

array dependency injection in spring?

Hi, is there a way to use dependency injection to inject all available implementations of a specific interface in spring? This is kind of the same thing as asked here for .NET. Though my aim is to use @Autowired for this: public class Foo{ @Autowired private IDataCollector[] collectors; } Is this supported, would this require h...

having problem with proguard trying to obfuscate code that uses Spring

My project uses spring for IoC. After obfuscation the application context fails to find the bean since it's class name has been changed. I tried to use -adaptresourcefilecontents option to get context.xml file be updated according to the class name, but it didn't work: the file wasn't changed. Any ideas? ...

DefaultMessageListenerContainer not working with Websphere MQ

Hello everyone, I am using spring 2.5.6 and spring-integration 1.0.3 and MQ client 6.0.2.2 I have had to add a message selector to my message-driven-channel-adapter, but now I am getting the following error: MQJMS2008: failed to open MQ queue ; nested exception is com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2085 It wor...

Logging user agent info on login with Spring Security

Hi, I am using Spring Security with LDAP for an application and I want to log the user-agent when the user logs in. However, I cannot access the request object in the Authorities Populator so I cannot access the user-agent information from there. I also tried setting the pattern in our logger (log4j) so it would log the user agent by ...

Exception thrown after processing onSubmitAction

Hi, I am very new to Spring and I have a simpleFormController with 2 methods. referenceData() with is called when the page loads and onSubmitAction() which is called on the submit of a form. I am getting a nullPointerExcpetion after all my onSubmitAction() code has completed and I suspect it has something to do with where the flow of ...

Eclipse Spring Builder set properties with Groovy beans

I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example, class MyGrooyClass { def propertyA } and in the spring configuration file I have something that looks like: <bean id="MyGroovyClassBe...

many-to-many (self referencing problem) vs double one-to-many

Hello! I'm facing some of the problem some of you already talked about and sorry to bring this out again. It's just like I still don't get certain aspect of hibernate. I'm using maven2, hibernate 3.2.5 ga, spring 2.6.5 SEC01, hsqldb 1.8.0.10, netbeans 6.7.1. I'm bulding a user and contat management and I've managed to get a working "m...

why is the springsource.com website built in drupal?

I was trying to learn a little about JAVA frameworks like Spring. I hit view source on springsource.com and it's totally Drupal (a PHP CMS). What's up with that? You would think they would build the site in their own framework, huh? ...

Putting array of arrays into a spring context

I just found a TestNG test case that uses Spring to provide its data source. As a result the code is quite clean and concise. However, I need to expand the test cases so they can take a variable list of inputs. Am I stuck using bean references for the list of lists as I've attempted below? Is there a way to do that and still be prett...

Spring's IOC with annotations is confusing for a Guice guy. Help to enlighten me

I came into IOC via Google Guice. And now I've been forced to use Spring 2.5.6 at work & I am lost because Spring is quite complicated. Here are some questions after reading bits of the spring docs: What is the difference between @Service, @Controller and @Component ? If I just want to auto wire my objects like Guice, do I need to be ...

Invalid property exception in spring.

Hi All, I am using spring in my application , When i am loading the springApplicationContext to get the beans i am getting the errors Caused by: org.springframework.beans.InvalidPropertyException: Invalid property "abc" Even though there is a property abc and the setter for that property in the bean. This is a weird error i ...

How to implement Logout feature using Spring Web Mvc

Hello All... I am new to Spring Web MVC.. Can I get some example or online link that shows me how to implement logout feature using spring web mvc ? I don't want to use the in built feature of spring security (i.e. ACEGI).. Thanks in advance... ...