spring

Spring map entries versus resources

Consider a factory bean. It takes a single property of type Map<String, Object>. It carefully checks all the Objects for 'instanceof Resource' and does resource processing appropriately. I configure this bean like: <bean id='fact' class='my.class'> <property name='map'> <map> <entry key="x" value="file:/WEB-INF/foo.txt"/> ...

Eclipse does not deploy jars into WEB-INF/lib directory

To integrate JSF with Spring I have added these lines in web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listen...

Web Console for Spring Application Context

Is there a way to expose my Spring applicationContext via a servlet or webapp so that I can manipulate and inspect the beans in the appcontext. ...

Is there a portable way to have "SELECT FIRST 10 * FROM T" semantic?

I want to read data in blocks of say 10k records from a database. I found Result limits on wikipedia and it seems obvious that this can't done with sql in a portable way. Another approach could be JdbcTemplate which offers many methods for queries, but how could I decide that enough rows have been read. Through the callbacks like RowMa...

Spring MVC "redirect:" prefix always redirects to http -- how do I make it stay on https?

I solved this myself, but I spent so long discovering such a simple solution, I figured it deserved to be documented here. I have a typical Spring 3 MVC setup with an InternalResourceViewResolver: <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org...

Java Date format

I have a spring web application that runs in Tomcat. I must set the date and number format for my application to a special format. Can I set the format in any descriptor to the special in my application or I can set the all system format only? ...

Using multiple property files (via PropertyPlaceholderConfigurer) in multiple projects/modules

We are currently writing an application which is split into multiple projects/modules. For example, let's take the following modules: myApp-DAO myApp-jabber Each module has its own Spring context xml file. For the DAO module I have a PropertyPlaceholderConfigurer which reads a property file with the necessary db connection parameters...

Stop a Java thread which calls an Oracle procedure

Hello, On a Spring/Hibernate web application, I'm using a Work Queue, built with Java Threads. The Threads's run() method calls an Oracle procedure, which can last a bunch of minutes/hours. All the Work Queue's threads are stored in a list. I would like to build an interface (JSP), where I could display a list of the running jobs, and ...

Spring Framework: Sending E-Mails that are generated from JSPs

Hello everyone, has anyone a good hint how to send E-Mails from Spring 3 that were created by a view (a jsp)? (the spring manual describes how to use Velocity as template engine for generating e-mail bodies, but is it also possible to use JSPs instead?) ...

Flex + SBI + dpHibernate, I think I missed something...

Hi all, So, my problem is : All my project is (well ?) configured but I don't have lazy loading ! This a sample project I'm making to prepare the real project coming just after. In simple words, I have 3 tables : Category, Product, Client, and the association between the last two, Buy. On the Flex side I have two simple datagrid, the ...

Is it possible to use Spring 3 @Autowired annotation inside @Service?

I'm using class that is not called by my @Controller directly and when I try to use @Autowired propeprty in that class what is defined as @Service, property is null. But @Autowired with same markup will work inside @Controller. Example code: @Service public class UsernameValidator implements Validator { @Autowired private UserDao...

How can I get H2 to work with Spring?

I am writing a test which extends Spring's AbstractTransactionalJUnit4SpringContextTests. In my application code I have a method which I call inside the test annotated by the following: @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW) Problem I run into a problem while using H2 as the underlying data source ...

Spring NamedParameterJdbcTemplate + an array of Integers + Sybase

Sooo.. We found a bug and the stack pretty much looked like this com.sybase.jdbc2.jdbc.SybSQLException: Class [java.lang.Integer not found. Check and make sure that the class has been installed, and an entry exists in Sysxtypes. Then I thought, aaaaw, I just have to convert 'em into primitives. int[] ids = ArrayUtils.toPrimitive(set....

How can I use the Parameterized JUnit test runner with a field that's injected using Spring?

I'm using Spring to inject the path to a directory into my unit tests. Inside this directory are a number of files that should be used to generate test data for parameterized test cases using the Parameterized test runner. Unfortunately, the test runner requires that the method that provides the parameters be static. This doesn't work fo...

Spring and Hibernate inside Axis2 inside Tomcat6

I'm try to create web service base on axis2 (without a ServletContext). I have code that work properly (Spring + Hebirnate) and try to put it into AAR as it describe in this article and this one . All work good except hibernate. I have: <bean id="dataSourceCommon" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="c...

What to do when Apache Tiles 2.1 does nothing when it has to ?

Hello, readers (girl) and readers (boy), I have a slighly f%*#@ probelm with Apache Tiles 2.1, I work with : Struts 2.1.8.1 Apache Tiles 2.1 Spring 3.0.3 Spring Security 3.0.3 My problem is : Apache Tiles does not work on each JSPs, it seems to have problem with <tiles:insertAttribute name="body" /> This insert no data. When i s...

why these functionalities i am missing,thought i have the correct spring 3.0 jar

Hi all, I am learning spring by reference documentation of 3.0 and i wanted to test the below functionality but these are not available.. @PostConstruct context.registershutdownhook P.S.: I am using jdk 5.0 when i type these in my eclipse,I am getting an error that these are not avaialble.. Below is my pom.xml: <projec...

Moving JSF Managed Beans to Spring beans

I just introduced Spring in a JSF web application, and now I'm feeling tempted to turn my JSF managed beans into Spring beans by moving these beans to the contextConfigLocation XML file (specifying org.springframework.web.jsf.el.SpringBeanFacesELResolver in faces-config.xml) instead of having the beans in the faces-config.xml file. I se...

Spring/Hibernate testing: Inserting test data after DDL creation

I have a Spring/Hibernate webapp that has some integration tests that run on an in-memory HSQL database. Hibernate takes this blank database and creates all of my test tables and constraints thanks to hbm2ddl=create. However, I have a new bean that checks for a particular config value from the database during its afterPropertiesSet() m...

fail for null arguments with @Inject

I've started using Spring 3 Java Config with the JSR-330 @Inject annotations. Unlike the Spring @Autowire, Spring does not fail at startup if the @Inject parameters are null. Is there a way to do this within Java Config? Edit: Just a clarification, I would like this as the default behaviour so I don't have to put @Required on every fiel...