spring-3

[Spring 3] Autowiring a service into a validator

This example is a bit contrived; I've simplified it to remove extraneous details and to focus on the problem I am having. I have a validator that looks like this: @Component public class UniqueUsernameValidator implements ConstraintValidator<UniqueUsername, String> { @Autowired UsernameService usernameService; @Override ...

Default value of form object's field

Hi there, I have a form where depending on the select state ([checkboxOn/checkboxOff]) a check box should appear or not. When the check box is displayed it should be checked by default. How to handle that situation, taking into account that when select is in 'checkboxOff' state, I would have MyFormObject.isCheckboxOn == false; when ...

Spring MVC 3.0: How do I bind to a persistent object

I'm working with Spring MVC and I'd like it to bind a a persistent object from the database, but I cannot figure out how I can set my code to make a call to the DB before binding. For example, I'm trying to update a "BenefitType" object to the database, however, I want it to get the object fromthe database, not create a new one so I do n...

spring mvc 3.0 caching

hi, I'm using spring mvc 3.0 with eclipselink and jpa and I'm experiencing following issue: I have this field in my app: @OneToMany(mappedBy = "stadium") private Set<FootballMatch> footballMatches = new HashSet<FootballMatch>(); when there is triggered some action that adds new items into set via Set.add(), the changes doesn't show up...

Build a WS with Spring

Hi, I need to create a WS with Spring 3.0.4.RELEASE to run in a Tomcat with Axis2. I'm following this doc: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-web-services-jaxws-export-ri (if that paragraph can be called "doc") Ok, here are the details: The java class: package foo;...

How to use property from property file specified in PropertyPlaceholderConfigurer in JSP

In my application context I have defined properties file: <context:property-placeholder location="classpath:application.properties" /> I want to get value of the property defined in that file on JSP page. Is there a way to do that in the way ${something.myProperty}? ...

Which maven2 artifacts are necessary to build a WS with CXF and Spring?

I'm trying to build a WS with Spring 3.0 and CXF. I'm following the steps of this article http://www.ibm.com/developerworks/library/ws-pojo-springcxf/ But in that article, the authors assume that you have cxf installed. I'd like to embed CXF in my .war. Thanks in advance. ...

What's the difference between <mvc:annotation-driven /> and <context:annotation-config /> in servlet?

Hello! I am migrating from Spring 2.5 to Spring 3. They have introduced <mvc:annotation-driven /> which does some black magic. This is expected to be declared in servlet configuration file only. In spring 2.5 I have just used <context:annotation-config /> and <context:component-scan base='...'/> tags declared both in application-cont...

Set Hibernate session's flush mode in Spring

Hi! I am writing integration tests and in one test method I'd like to write some data to DB and then read it. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:applicationContext.xml"}) @TransactionConfiguration() @Transactional public class SimpleIntegrationTest { @Resource private DummyDA...

Minimum JARs for Spring 3.0 dependency injection

Similarly to this question regarding an earlier Spring version, what are the minimum dependencies required for an application to use Spring 3.0 dependency injection only? The application context will be configured by XML only. Spring depends on a logging framework, so assume I already include these JARs for logging: jcl-over-slf4j.ja...