spring

Add Spring 3.0.0 java based IOC to JUnit 4.7 tests

There is a doc http://static.springsource.org/spring/docs/2.5.6/reference/testing.html how to add IoC support to junit tests using xml-configuration, but I can not find example for java-based configuration... For example, I have java-based bean: public class AppConfig { @Bean public Test getTest() { return new Test(); } } And...

Is there an easy way to create a confirmation dialog using dojo-toolkit or spring-js?

Hi, In my spring webapplicaiton I would like the user to confirm the deletion of an item before actually do it. I've looked for a simple example using dojo, but so far I didn't come up with a solution that suits such a simple and common use case. Any hints? ...

Spring Web flow configuration error

Hi all, I am trying to setup spring web flow. I am using spring 2.5 jars and swf 2.0.8 jar Here is my configuration file: <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="order" value="1" /> <property name="mappings"> <props> <prop key="index.htm">indexController</prop> </pro...

Spring MVC 3 Validation - Unable to find a default provider

I get an error when trying to set up Spring MVC validation. javax.validation.ValidationException: Unable to find a default provider I read in the documents that the default provider they use is the hibernate-validator. Do I need to include this library to get validation to work? Is it okay to include this library even though i'm not...

what tomcat native library should I be using in production?

When I compile my spring mvc app, I get this in the output: INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_17\bin;...... What exactly should I use in production that this is referring to? ...

How do I prevent Spring/Hibernate from automatically committing my modifications to the database?

Hello Overflowers, I am working with Spring and Hibernate. I have an object which was retrieved from the database with HibernateTemplate. When I modify this object Hibernate is making inserts into the database before the data is ready to be inserted, the result is a lot of database errors along the line of "cannot insert NULL into ......

Is there a transaction management for DAO in Spring framework?

Is there any kind of out-of-the-box transaction management support for pure DAO in Spring framework? ...

When using Autowire, where do you set the bean you want wired up?

When you mark something with the Autowire annotation, you are saying you want this particular e.g. class to be automatically wired for DI. Now where exactly do you set the target class to be used in the Autowire? reference: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-annotation-conf...

including style sheet in a jsp page with Spring MVC

I am having trouble linking to a style sheet from a jsp page. I believe it has something to do with my directory structure which is: WEB-INF |-- css | |-- main.css | |-- jsp |-- login.jsp I have tried various forms of the standard html link tag such as: <link href="css/main.css" rel="stylesheet" type="text/css" medi...

Spring form handling, mapping an entity to form inputs

Just looking at the petclinic sample application, and trying to learn form handling. It seems the form maps to an entity 1:1 correct? Is there any other configuration that has to be done, or will spring just know that all the form inputs map to the entity because that is what was added to the model in the GET request? @Controller @Req...

Spring MVC 3 - Binding parameters to backing object

I am trying to setup an edit form for my User object. I have automatic binding from the form to the user object working fine. I'm wondering how do I prevent malicious users from binding to fields of my User object that I don't want them to? For example, my user object has userName, and it also has points. When they click edit user, I...

How to set custom attributes to user details object in spring security 3.0

The question says it all. In spring security 2.x we can set the custom values to the user in the userattributes. Is there a similar/alternate way of doing the same in spring secuirty 3.0?? ...

spring mvc test using eclipse and maven2

So I created a simple web app using maven, the pom.xml is setup in Eclipse just fine. I added apache commons, spring 3.0 as a dependancy. I created a test controller using annotations, and a jsp file. In eclipse, I only see a Run option, and no build option. With maven2 pom.xml setup etc., is just clicking on Run enough to build the p...

How can I use a JSP to create a dynamic Javascript file?

I'm using a Jboss5/Spring/Struts implementation, and I'm not familiar enough with JSP technology to know how to do this. Is this even possible? ...

setting -source to 1.5, it is set to 1.3 apparently

I am using eclipse, with maven2 plugin. I am trying to setup a simple annotations based spring 3 mvc web application. So I went to RunAs and clicked on 'maven build', I set the goal as 'compile'. When it compiles, I get the error message: E:\dev\eclipse\springmvc2\src\main\java\web\HomeController.java:[5,1] annotations are not support...

what's the possible solution to build a app host(such as wordpress.com or google group) in java?

Hi All, I'm wondering how wordpress.com or google group host multiple applications for different party. For wordpress, I guess it will create a subdomain for each user and configured a virtual host in Apache for this installation. Of course, a database is installed for this user (or tables with prefix). Will the wordpress application ne...

Error during compile

I am using eclipse with maven2 plugin. Maven created a /src folder, so I created my HomeController.java file in the following path: /src/main/java/web/HomeController.java When I compile using the RunAs mavin build, with a goal set to 'compile', I get the error: E:\dev\eclipse\springmvc2\src\main\java\web\HomeController.java:[5,1] can...

Using eclipse with maven plugin, how should I setup my build so it deploys to tomcat?

Using eclipse with maven plugin, how should I setup my build so it deploys to tomcat? I'm not sure if I have to do this in 1 or 2 steps, but I want to compile my spring mvc (3) application and deploy to my local tomcat. Right now I just mapped the RunAs -> Maven build to a 'compile' goal type. I'm very new to do this so not sure how...

simpleJdbcTemplate. - insert and retrieve ID

I'm putting the data into database with simpleJdbcTemplate. simpleJdbcTemplate.update("insert into TABLE values(default)"); I dont want to put any data because i dont need it for my unit test purpose. How can i get the id from the inserted row? I can retriev the current sequence value but if somebody else will do a insert then i will...

Spring HibernateDaoSupport : lazy-loading problem ?

Greetings, In my domain model, 'Family' has many 'SubFamily's 'SubFamily' has many 'Locus's and relationships are bi-directional with lazy-loading. ie. 'Locus' can access in parent 'SubFamily' using alocus.getSubFamily(); Down below snippet I have given the DAO method to retrieve a Locus . In my webapplication (Wicket based) I g...