spring

Auto-wiring a List using util schema gives NoSuchBeanDefinitionException

I have a bean that i want to inject with a named list using Spring util namespace <util:list id="myList"> but Spring is looking for a collection of beans of type String instead. My broken test is: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class ListInjectionTest { @Autowired @Qualifier("myList") private ...

Is it bad practice to put view code in the controller?

In MVC (such as JSP and Spring), is it bad practice to view related code in the controller? In my case, the controller does some work and then hands off the results to the view (JSP). In the case of a status message, I can pass the entire message text to the view, or pass a key and let the JSP map it to the message text. Example: Mess...

When is it appropriate to use an EAR and when should your apps be in WARs?

We have many Spring web applications to make on a WebLogic server and are curious about when WARs should go in an EAR and when they should just exist as WARs. Occassionally, the WARs will need to access common logic JARs, but I don't see why these would need to go into an EAR when they could just be packaged into the WARs. From what I u...

How does ThrowawayController in Spring MVC get the parameters from a request?

This is an example of using ThrowawayController in Spring MVC: public class DisplayCourseController implements ThrowawayController { private Integer id; public void setId(Integer id) { this.id = id; } public ModelAndView execute() throws Exception { Course course = courseService.getCourse(id); ...

MergingPersistenceUnitManager

I have recently found your reply in a topic about using multiple persistence.xml files from multi module project. You said something about MergingPersistenceUnitManager. Could you please tell me where can I find it ? The link you provided seems not to work. ...

Which artifact for org.springframework.mail?

I'd like to use spring support for sending mails. My project is built with maven-2 and I use spring-core 2.5.5 I tried to look in maven central repo for artifact to include in my pom.xml, and the only one I found is spring support. The problem is that the highest version in repo is 2.0.8 and it depends on spring-core v. 2.0.8. Should I ...

Updating built in Spring/Hibernate Archetype in Maven?

The current version of Hibernate is 3.26 and Spring is 2.54 when I create a Spring and Hibernate project based off the default Archetype. How can I have Maven grab the newest release versions? I tried changing my spring version from 2.5.4 to 2.5.6 but 2.5.4 was still included in the generated war file. ...

When do @SessionAttributes in SpringMVC get removed? (With code sample)

Under what exact circumstances do @SessionAttributes get cleared? I've discovered some confusing behaviour when trying to use two models in a page. When I do a GET followed by a POST using this controller... @Controller @RequestMapping("/myPage*") @SessionAttributes(value = {"object1", "object2"}) public class MyController { @Reque...

Spring RegisterSingleton

I have a following object: public class TestObject { public String Something { get; set; } } and a following objects file: <?xml version="1.0" encoding="utf-8" ?> <objects xmlns="http://www.springframework.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.n...

how to display custom error message in jsp for spring security auth exception

I want to display custom error message in jsp for spring security authentication exceptions. For wrong username or password, spring displays : Bad credentials what I need : Username/Password entered is incorrect. For user is disabled, spring displays : User is disabled what I need : Your account is diabled, please contact ad...

How to receive what was sent by convertAndSend?

I'm reading Spring Framework reference, chapter about JMS integration. There are some examples for sending text messages and asynchronously receiving them (by listeners). And there is also an example for JmsTemplate function convertAndSend which converts given object to a message. The reference says: By using the converter, you and y...

Parent Key Not Found - Spring Transaction Management

I am working with your typical three layered application that has a presentation layer, a business layer, and a DAO layer. It is a Java web application that uses Spring MVC, Spring Security, and Spring's transaction management from the business layer down. It is communicating with an Oracle 10g database. I have a business layer method ...

How to invalidate spring session when the app server session times out?

I am working on a struts2/spring/hibernate application running in Tomcat 5.5 server. i have defined my struts action in session scope. The problem i am facing is even when the server session times out, and at that time, if the user clicks on any link in the application, he is redirected to the login page.(This is right and as expected) B...

Pax-import-bundle and Spring DM bundles

Hi, I'm following the examples from Modular Java but I'm having trouble with chapter 6 and adding the Spring DM modules to my project. I run: pax-import-bundle -g org.springframework.osgi -a spring-osgi-extender -v 1.2 -- -DwidenScope -DimportTransitive When running pax-provision the Spring DM bundles are not resolved. I get complaint...

attempt to create saveOrUpdate event with null entity

Hello all, I've run into a problem I can't figure out and Google search does not return much (I should of thought about posting my question here first ;-). So I've got a GWT app, that makes a rpc call to a server to save/create a new entity. However, the Spring-Hibernate back-end throws an exception with the following error message: ...

Maven Tomcat Embedded

I am trying to run a Spring webapp using maven with the mvn tomcat:run command, but whenever I navigate to http://localhost:8080/myApp, I get the error: "The requested resource () is not available". Nothing shows up in the logs. I think my app is supposed to be deployed to "/" instead of "/myApp". Is there a way to do this? Maven out...

How to embed HSQLDB in file with Spring to a WebApp

I have a webApp whit Spring and works correctly when I use HSQLDB in server mode but in file mode it only passes the unit test. This is my data source: <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="org.hsqldb.jdbcDriver" /> <property na...

Wiring a UserServiceFactory of Google AppEngine using Spring

I wanted to wire the Google App Engine user service in Spring by first creating a UserServiceFactory bean and then using that to get an instance of UserService. <bean id="googleUserServiceFactory" class="com.google.appengine.api.users.UserServiceFactory"></bean> <bean id="googleUserService" class="com.google.appengine.api...

Spring Framework Events

I was reading through spring framework documentation and found a section on raising events in Spring using ApplicationContext. After reading few paragraphs I found that spring events are raised synchronously. Is there any way to raise asynchronous events? your help is much appreciated. I am looking something similar which would help me t...

Can I inject an interface subtype in Spring?

It doesn't seem to be working right now. I get a java.lang.NullPointerException I have a class that implements an interface public class LearnerDao implements BaseDao { private BaseDao dao; public void setDao(BaseDao dao) { this.dao=dao; } . . . } This is my wiring <bean id="pm" factory-bean="pmf" facto...