spring

Trying to setup externalizing properties in spring

Hi all, I'm building my project with maven so according to maven way, config should be in src/main/conf , how can I say to my spring application context that that is where jdbc.properties is found? Here is example bean : <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <proper...

Referencing a file via classpath in spring context

I'm trying to set org.springframework.beans.factory.config.PropertyPlaceholderConfigurer spring bean, I have jdbc.properties in src/main/config .. when I put this file in src/main/resources and put classpath: in value my app deploys successfuly. This works when jdbc.properties is located in src/main/resources <property name="location"...

Encoding issues with Spring and Freemarker

I'm working on a project using Freemarker and Spring running on Jetty. It will involve displaying characters from many different countries so I'm trying to set the encoding to UTF-8. However, no matter what I do, it remains ISO-8859-1. I tried to create a filter in my web.xml and I've tried putting this response.setCharacterEncodin...

extending spring form tag library attributes

I'm using Spring's form tag library in a Spring MVC application that I am developing. The company I am working for has implemented some company-wide policies based on the definition of custom attributes for certain tags. For instance, by default (though the inclusion of a standard javascript file) all tags have their values automaticall...

What's the most minimal way to achieve Dependency Injection?

I've been reading about Spring and although it's claimed to be a less complex alternative to EJB, I'm having a hard time wrapping my head around it. Is there a more minimal way of achieving Dependency Injection than adopting the Spring approach? ...

Spring+JSP url building best practices

I wonder if there are any good practices for addressing Spring controllers in JSP. Suppose I have controller: @Controller class FooController { // Don't bother about semantic of this query right now @RequestMapping("/search/{applicationId}") public String handleSearch(@PathVariable String applicationId) { [...] } } Of co...

HOWTO: disable jmx in activemq network of brokers (spring, xbean)

Since I've struggled a lot with this problem, I am posting my solution. Disabling jmx in an activemq network of brokers removes race conditions about the registration of the jmx connector. When starting multiple activemq servers on the same machine: Failed to start jmx connector: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.n...

How do you use stereotype annotations in Spring 2.5.x?

When moving to Spring 2.5.x I found that it adds more stereotype annotations (on top of @Repository from 2.0): @Component, @Service and @Controller. How do you use them? Do you rely on implicit Spring support or you define custom stereotype specific functions/aspects/features? Or is it predominately for marking beans (compile time, conce...

fire and forget compared to http request

I'm looking for opinion from you all. I have a web application that need to records data into another web application database. I not prefer to use HTTP request GET on 2nd application because of latency issue. I looking for fast way to save records on 2nd application quickly, I came across the idea of "fire and forget" , will JMS suit fo...

Spring MVC with annotations: how to beget that method always is called

hi, I'm currently migrating a project that is using Spring MVC without annotations to Spring MVC with annotations. This is causing less problems than expected but I did come across one issue. In my project I have set up an access mechanisme. Whether or not a User has access to a certain view depends on more than just the role of the Us...

GAE messaging service

Let's say I want my corporate server to communicate with Google App Engine and vice versa. I know that GAE does not support JMS,RMI etc. What is the best alternative for this kind of communication? Use task queue? (I think HTTP get() is not suitable for this kind of communication). Both my corporate server and GAE application use Spri...

In a project that uses a DI framework, should you NEVER use the 'new' operator?

I'm trying to wrap my head around Dependency Injection. One of the things I'm confused about is whether all of your object instantiation needs to be controlled by the DI framework (Spring, Guice, etc). Or, if not, how do you determine which objects are instantiated by the framework and which objects are instantiated with the new oper...

How to access/use custom attribute in spring security based CAS client

I need send certain attributes(say, human readable user name) from server to client after a successful authentication. Server part was done. Now attribute was sent to client. From log, I can see: 2010-03-28 23:48:56,669 DEBUG Cas20ServiceTicketValidator:185 - Server response: [email protected] <cas:proxyGrantingT...

How to run Spring 3.0 PetClinic in tomcat with Hibernate backed JPA

OK, this probably is supposed to be the easiest thing in the world, but I've been trying for the entire day, and it's still not working.. Any help is highly appreciated! EDIT: For the correct procedure, please see Pascal's answer. My wrong (since I did not disabled LoadTimeWeaving) procedure is left for reference..: What I did: D...

What is the equivalent of Struts ActionMessages in Spring MVC?

Please let me know if you have any idea about it. Thanks EDIT What ActionMessages is? ActionMessages is basically a class that holds messages that you want to display on a JSP page. Messages can be added in ActionMessages in an Action(controller) class. On the JSP, the position where the messages are intended to be displayed, is mark...

Spring Security 3.0 and Active Directory LDAP: DOMAIN\user login

I would like to have users authenticate against an ActiveDirectory LDAP server using the DOMAIN\user.name syntax. I think that should be possible with SpringSec 3.0 since the docs mention an alternative syntax which I guess refers to the DOM\user syntax instead of a bind DN, but the docs don't elaborate further. Is there some way to con...

Integrating GWT, Spring and JPA (Eclipse-link) in Weblogic 10

Hi, My application architecture looks like this. GWT in the UI layer -> Calls GWT RPC service (servlets) -> Looksup Spring Beans -> Calls the DAO layer which is implemented in JPA (EclipseLink). I have successfully tested the application with GWT rpc services directly calling the JPA layer. But I am having trouble integrating spring ...

Spring Framework HttpRequestHandler failure

We have an application which communicates via REST requests made by clients. The REST requests contain "region name" and a "ID" as parameters So, a request would look something like this (for a DELETE) http://host:port/regionnameID These REST requests between regions in a federation are properly URL encoded I find that th...

Injecting property values via Spring by Environment

I have a Property File like this: frame.server.dev=mark.is.cool frame.server.test=chris.is.cool frame.server.qa=mitch.is.cool frame.server.prod=cory.is.cool I need to inject the correct value based on the environment. Since we have one ear file that we move from environment to environment, I need to do something like this: <util:pro...

Ant target for compile-time code instrumentation with Spring aspects

I have developed a web application using Netbeans 6.7 and Ant. The webapp works, but I would like to refactor the code to use @Configurable Spring annotation for cleaner dependency injection. I was able to get load-time weaving (LTW) of Spring aspects to work intermittently (see http://forum.springsource.org/showthread.php?t=86904). At...