spring

How to get the request context in a freemaker template in spring

Hi, How to get the request context path in freemarker template when using with spring. My view resolver is like this <bean id="freeMarkerViewResolver" class="learn.common.web.view.FreemarkerViewResolver"> <property name="order" value="1" /> <property name="viewClass" value="org.springframework.web.servlet.view.fr...

Testing an AspectJ Aspect

When writing aspects, how can I test that they do match and that they are invoked when I want them to? I'm using @Aspect declarations with Spring 2.5.6. I don't care about the functionality, that's extracted and tested otherwise. ...

map url to controller

in my applicationContext.xml, i put this <bean id="something" class="com.to.theController"/> in com.to.theController i have this method like @Controller public theController{ @RequestMapping(value="/api/add", method= RequestMethod.GET) public String apiAddHandler(Model model){ model.addAttribute("api", new Api()); re...

Can't set LevelRangeFilter for log4j

I am using this property file to setup log4j in Spring: log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender log4j.appender.EMAIL.filter=org.apache.log4j.varia.LevelRangeFilter log4j.appender.EMAIL.filter.levelMin=FATAL but getting: log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.LevelRangeFilter". Any...

Session handling in Hibernate with Spring

Hello, I am not a beginner in hibernate, but I am a beginner in working with Hibernate in Spring. I read the book Spring in Action. So I wrote a small application to comprehend the examples in the book. Here an extraction of my application. I can give you more, if you want. @Transactional(propagation = Propagation.SUPPORTS, readOnly = ...

WebSphere and PropertyPlaceholderConfigurer

Hi, I'm a big user of properties (with PropertyPlaceholderConfigurer) for making my application as "dynamic" as possible. Almost all the constants are defined as such. Anyway, I'm currently defining a default.properties which comes shipped with the default WAR. In other environments (Acceptance/Production) I need to overwrite of the co...

springsource tool suite (eclipse) tutorial?

any tutorial on this how to enable spring support for my existing project,and fast way to create my bean defination file.xml files..? i know manually way of creating applicationcontex.xml..etc .but wonder is there any fast way when using springsource tool suite. tutorial,article,video guide would be good ...

Best way to manually pull a spring bean?

How do I pull a spring bean manually? I have a rather large web application, and in a given service, a transient object requires access to a bean that is machine specific (database connection info.) Since the application runs in a cluster, this transient object (which can bounce between servers) always needs to grab the correct connectio...

Refreshing/replacing beans in the ApplicationContext. Possible or am I missing the point?

First off, I think I'm trying to use Spring incorrectly, but confirmation would be appreciated. I am trying to reset a single bean in mid-application. My initial configuration works just fine. My scenario 1 Insurance Claim bean (session scope) 1 Claim details bean which is a multiactionController (getClaim&setClaim enabled, protot...

Can't send email using Spring and Quartz

I'm using Spring,Quartz to schedule send email function.But I can't do that This is my error java.lang.NullPointerException at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTr ansport.java:557) at org.springframework.mail.javamail.JavaMailSenderIm pl.doSend(JavaMailSenderImpl.java:382) at org.springframework.mail.javamail.JavaMailSend...

spring mvc annotation @RequestAttribute similar to @RequestParam

Hi, I would like add an annotation similar to @RequestParam, though have it pull the values from the request attribute rather than the request param... Is there an example or explanation how to create my own annotation for this and the handler / binder needed as well? Thanks ...

Spring XML inner bean question

I have created a spring bean that contains a list of other beans, like so: <bean name="InventoryManager" class="InvManager"> <property name="slots"> <bean class="HeadSlot" /> <bean class="ShoulderSlot" /> <!-- ... --> </property> </bean> The problem, though, is that elsewhere I have used an @Autowired annotation in ano...

An RMIPRoxyFactoryBean factory in Spring?

I'm currently using a Spring RmiProxyFactoryBean to access remote services. Since requirements have changed, I need to specify at runtime a different host - there can be many of them - , but the remoteServiceInterface and the non-host components of the remoteServiceUrl remain the same. Conceptually speaking, I'd see a bean definition si...

log4j:WARN No appenders could be found for logger in web.xml

I already put the log4jConfigLocation in web.xml, but still, i get warning log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. what did i missed out? <context-param> <param-name>contextConfigLocation</param-name> <par...

No mapping found for HTTP request with URI [/WEB-INF/pages/apiForm.jsp]

my handler forwards to internalresourceview 'apiForm' ? but then i get error 404 RequestURI=/WEB-INF/pages/apiForm.jsp . i'm sure apiForm.jsp located in /WEB-INF/pages/ 13:45:02,034 DEBUG [org.springframework.web.servlet.view.JstlView] - Forwarding to resource [/WEB-INF/pages/apiForm.jsp] in InternalResourceView 'apiForm' ...

How can i register a global custom editor in Spring-MVC ?

Hi, I use the following custom editor in MANY Spring-MVC controllers according to: A controller binder.registerCustomEditor(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, NumberFormat.getNumberInstance(new Locale("pt", "BR"), true)); Other controller binder.registerCustomEditor(BigDecimal.class, new CustomNumberEditor(B...

intercepting requests before they go to the controller in an annotation-based Spring web-app

Hello, I'm developping a web-app and i'm using Spring framework. Thing is, i never properly learned to use Spring and i'm kind of lost in all this. However, using Annotations-based controllers, i was able to create most of my app! Now, the problem is that i would need to be able ton intercept requests before they're sent to the contro...

Is there a good DI framework suitable for Java 1.4 and SE (Swing) apps?

I am looking for a dependency injection framework for a Java SE (Swing) application that runs under JDK 1.4. Are there any recommended DI frameworks that I can use? (Guice and other annotation-based frameworks are out, and I don't want to mess with something like Retroweaver.) Also, is Spring suitable for use in a Java SE application? ...

write java wrapper

1.this is how my dao class look like where the transaction code keep repeat for every method. possible to put these snippet code in super class so that i do no need to repeat below code all the time? any elaborate how to do this? 2.if there is a need to put the snippet in super.class. should the super.class be static? for (int i = 0;...

jdbctemplate, jpatemplate

in my dao, in each method, when i call jdbctemplate, i should call with new jdbctemplate(). right? or get one static instant of jdbctemplate and reuse ? how about jpatemplate? ...