spring

Spring 3 DI using generic DAO interface

I'm trying to use @Autowired annotation with my generic Dao interface like this: public interface DaoContainer<E extends DomainObject> { public int numberOfItems(); // Other methods omitted for brevity } I use this interface in my Controller in following fashion: @Configurable public class HelloWorld { @Autowired pri...

Spring AOP pointcut that matches annotation on interface

Hello, this is my first post here, so I apologize in advance for any stupidity on my side. I have a service class implemented in Java 6 / Spring 3 that needs an annotation to restrict access by role. I have defined an annotation called RequiredPermission that has as its value attribute one or more values from an enum called OperationT...

Different i18n in spring according to url

I have a spring web application that is required to work as following the application will be accessed from two different URLs www.domain1.com and www.domain2.com and it is required that the two URLs looks like two different applications with different CSS and I18n. for the css part is done but I am stuck with the i18n part How to m...

Accessing Spring beans from a Tiles view (JSP)

In Spring MVC I can access my beans in JSP using JstlView's exposedContextBeanNames (or exposeContextBeansAsAttributes). For example, then, in my JSP I can write (${properties.myProperty). But when the same JSP is a part of a tiles view, these properties aren't accessible. Is possible to configure Tiles properly or access these propertie...

Spring/Hibernate: InvocationTargetException when deleting entity

I'm sorry if this question is a bit vague, but I'm quite confused. I've got a controller that calls a service to delete an entity and then create an entity in its place. In the service, I've got my DAO, and my entity, and I want to delete my entity, so I call DAO.delete(entity); Then, seemingly out of nowhere, I get an InvocationTarg...

Configuration of tibco jms with Spring

Hi. Now I have java code which starts tibco jms subscription with several steps: Properties props = new Properties(); props.put("java.naming.provider.url", namingProvider); props.put("java.naming.factory.initial", namingFactory); props.put("java.naming.referral", namingReferral); props.put("java.naming.se...

Is there anyway to bring web @Context into JUnit (CXF+Spring)

I am trying to create unit test environment to test RESTFul services (cfx+spring) in my dev environemnt. To test RESTFul Services, I require @Context within JUnit test cases. @Context should contain HttpRequest, HttpSession, ServletContext, ServletConfig and all other webserver related information. I have setup the JUnit for the above, ...

What's the best way to do XMLObject Validation.

Hi All, I'm doing Sprimg WS at my workplace. We run into some strange validation problems, where if a user passes "Dog" for a boolean value. It still accepts it and blows up. I would like to know what's the best way to handle this kind of problem. Requirement: Based on the SOAP request, If there are any validation errors, return the se...

sitemesh and tiles 2.1 integration with spring MVC

Is posible to integrate sitemesh and tiles 2.1 with spring mvc ? I want to composite the layout with tiles and then decorate with sitemesh. I was using tiles like that. <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> ...

Whats the consensus on Spring p namespace for Beans?

It's been out for a while so I am wondering if people are using the p XML namespace within their Spring configuration files. Is it a helpful shortcut? Is it a good idea that ended up in the trash can? Where does the Java community largely stand? ...

java logging nightmare and log4j not behaving as expected with spring + tomcat6

I have a spring application that has configured log4j (via xml) and that runs on Tomcat6 that was working fine until we add a bunch of dependencies via Maven. At some point the whole application just started logging part of what it was supposed to be declared into the log4.xml "a small rant here" Why logging has to be that hard in java ...

Spring redirecting back to referrer

I have some resources in my application that require redirection to another resource (form) if some context information is not set. After the context gets set (requires two user steps), I need to redirect back to the requested resource. How do I achieve that. I am using annotation based controllers in Spring 3. Is org.springframework.sec...

Why does my JSF + Spring web application output JSF source code instead of interpreted HTML page?

I'm new to both JSF and Spring Framework and I'm trying to figure out how to make them work together. My current problem is that application outputs my JSF files without interpreting them. Here are some snippets of my code which I believe might be relevant: dispatcher-servlet.xml <bean id="urlMapping" class="org.springframework.web.se...

Spring validation @AssertTrue

How do I display on a view jsp validation error message that occurs as a result of @AssertTrue annotation? It isn't tied to a specific field, but I am using it to validate a combination of fields. If I use <form:errors path="*"/> that will display all the errors for that form? ...

Create spring beans, based on a comma-separated list of classes

Is there a way in Spring to create a collection, or array, of beans, based on a comma-separated list of classes. For example: package mypackage; public class Bla { private Set<MyBean> beans; public void setBeans(Set<MyBean> beans) { this.beans = beans; } } With the application context: <bean id="bla" class="mypackage.Bla"> <pro...

When uploading Arabic files in Spring, filename ends up with XML entities instead of Arabic glyphs

I am using Spring upload to upload files. When uploading an Arabic file and getting the original file name in the controller, I get something like: &#1575;&#1604;&#1605;&#1594;&#1601;&#1604;&#1610;&#1606;.png I expect it to be: المغفلين.png Any ideas why this problem occur? ...

Job queueing and execute Mechanism

In my webservice all method calls submits jobs to a queue. Basically these operations take long time to execute, so all these operations submit a Job to a queue and return a status saying "Submitted". Then the client keeps polling using another service method to check for the status of the job. Presently, what I do is create my own Queu...

sitemesh and spring MVC decorator pattern problems

I have sitemesh with spring working, this is the configuration: decorator.xml <?xml version="1.0" encoding="UTF-8"?> <decorators defaultdir="/styles"> <excludes> <pattern>/exclude.jsp</pattern> <pattern>/exclude/*</pattern> </excludes> <decorator page="application/themeManager/theme.jsp" name="dos"> ...

Change spring bean properties at configuration time

In a spring servlet xml file, I'm using org.springframework.scheduling.quartz.SchedulerFactoryBean to regularly fire a set of triggers. <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref local="AwesomeTrigger" /> <ref local="GreatTrigger" /...

How does init() get called on a Handler in a WebApp

Hey, I have a Handler object that functions kind of like a service. It has a public init method defined in the Implementation but not the Interface. This Handler is also being autowired via Spring. How does the init method get invoked? Is it via Spring or does Tomcat call this? ...