spring

java spring and ftl

I defined a modelview object named "buttonpressed" in spring controller file and I need to access that modelview object in ftl(freemarker) file which is being returned as a view from a controller like abcd.java The abcd.java controller code is as below if (questionAnswer.getAnswerId() == 1045) { modelAndView.addObject("buttonP...

Naming convention for Spring application context XML

I am deciding on a naming convention for my Spring application context files. I've come across this blog and a couple of tutorials suggesting applicationContext-<name>.xml is the way to go. I'm generally not a find of mixing camel case with dashes/underscores. What are some other naming conventions have you seen? Edit: I'm also thinking...

Using JDBCTemplate with a Hibernate SessionFactory?

We have a Spring/Hibernate app and would like to add a small amount of JDBC for reasons involving performance and development time. I can make this dao subclass HibernateDaoSupport and use the session's connection to perform my JDBC, but I'd rather use JdbcTemplate. JdbcTemplate, however is initialized using a java.sql.Datasource. How...

Disable Outlook Email Forwarding in Java

In Outlook there are options to disabled replying to and forwarding of emails. Granted this is only a rudimentary level of security as someone can always copy / paste the email content, but it does prevent accidental forwarding of confidential emails. My question is how can these options be disabled when sending a mail using Java? I a...

GWT and Spring, is it worth it?

Is there any reason to use Spring (or other similar frameworks) as a server for GWT RPC? As far as I can tell, 99.9% features of Spring will not be used. Yet, lots of people are looking for best ways to use them together. Could someone please explain, what are the benefits of using MVC frameworks (on server) with GWT, when all you need ...

Spring JDBC support and large dataset

When using one of the various JDBC template methods I am confused on how to iterate/scroll over large result sets (which won't fit into memory). Even without a direct exposure of an Iterable interface I would at least expect instances of RowCallbackHandler to get called while the query is executing not after it's finished (or the heap ov...

Spring: Is there a simple non-web tutorial?

I'm attempting to create a Spring application (NOT web application) to perform some simple tasks. Eventually they will hook up with some other Spring apps around the network, but for now I'm keeping it simple. I have a CheckForNewItems class (extending Timer) which is configured to run every 10 seconds. I can confirm it runs by calling ...

Resolve JNDI lookups from Spring application context?

In our Spring application we use clustered Hibernate Search with ActiveMQ which sets up some objects via JNDI. These objects are configured via the Spring application context and I am looking for a way to resolve JNDI calls to these objects. All I could find was the JNDI lookups from the Spring context. We need it the other way around...

Spring Dependency Injecting an annotated Aspect

Using Spring I've had some issues with doing a dependency injection on an annotated Aspect class. CacheService is injected upon the Spring context's startup, but when the weaving takes place, it says that the cacheService is null. So I am forced to relook up the spring context manually and get the bean from there. Is there another way ...

Why does calling close() on an InitialContext break JNDI for all future lookups (Glassfish)?

The second JNDI lookup in the code below fails with an exception when running as a standalone application against Glassfish (which has been configured to expose a QueueConnectionFactory and a DataSource via JNDI). However, the code works fine when the line jndiContext.close() is removed. In the real code, the call to close() is being ma...

Configuring Spring based servlet with sysadmin defined properties

I have a web application that's based on Spring and the application contexts, applicationContext.xml and myServlet-servlet.xml contain settings that should be configurable by the sysadmin in deployment. What's the best way to enable changing of settings like [database server details, remote webservice endpoints, etc] without requiring e...

How to specify an object property type in Spring.NET

I am trying to create an object in Spring where one of its propertys is of type object. Now if I do the following: <object id="MyObject" type="...." singleton=false> <property name="my_property" value="4"> </object> Then the property my_property will be a string object. Is there a way do something like: <object id="MyObject" type=...

Spring AnnotationHandlerMapping not working

Hi, I'm new to spring controllers using annotated controllers. Here is my configuration Bean definition <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> Controller package learn.web.controller.annotation; import javax.servlet.http.HttpServletRequest; import learn.web.controller.Bas...

Advantages to adding Spring to Flex

What are some of the advantages in adding Spring into a Flex / AIR application? And When would you recommend using Spring? ...

problem integrating flex with spring

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'flex:remoting-destination i got this error when i tried to build my file i wrote the 'flex:remoting-destination' in a web-application-config file can any one help me regarding this. ...

Trouble configuring AspectJ LTW with Tomcat and Spring

Hi all, I'm having some problems getting load-time weaving to work with Spring in my Tomcat 6 webapp. I only want to use it for transactions (so that self-invocation respects transactional annotations, which it doesn't with AOP proxying). It appears that the weaver is being loaded, but my annotated classes aren't actually being woven. Wh...

Wiring Twitter class of Twitter4j in Spring

I need only a single instance of Twitter class in Twitter4j in my Spring container. My problem is that I can see no way to set the oauth consumer in the Twitter class. As I far as I know,you can only wire using a setter method which only takes in one parameter. Not two. For example there is think there is no way I can wire something like...

Spring: JUnit-Test: applicationContext is not loaded...

Hi all, I've got the following Test-class, but it doesn't matter what I set as "ContextConfiguration-locations" - it never set my UserService. And it doesn't throw any error when I set a non-existing file in the locations-property... what am I doing wrong? @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "cla...

exception deploying on jboss : argument type mismatch

hi everyone! I'm getting a very weird exception when trying to deploy my app on JBOSS 5.0.1 GA . The strangest thing is that the application deploys flawlessly on JBOSS 5.0.0 CR2. I upgraded the version to 5.0.1 GA as I don't want to make use of a Candidate Release (CR) version for a professional application. You can see the exception ...

How do you set cache headers in Spring MVC?

In an annotation-based Spring MVC controller, what is the preferred way to set cache headers for a specific path? ...