spring

Considering moving from Java/Spring MVC to Grails

I'm currently using Java & Spring (MVC) to create a webapp, and I'm considering moving to Grails. I'd appreciate feedback/insight on the following: I have multiple application contexts in the current Java/Spring webapp that I load through the web.xml ContextLoaderListener; is it possible to have multiple application contexts in Grails?...

How to make safe frequent DataSource switches for AbstractRoutingDataSource?

I implemented Dynamic DataSource Routing for Spring+Hibernate according to this article. I have several databases with same structure and I need to select which db will run each specific query. Everything works fine on localhost, but I am worrying about how this will hold up in real web site environment. They are using some static cont...

How to read changed values with native query during one transaction? (Spring and JPA)

We have container transaction with Spring and JPA (Hibernate). I need to make an update on a table to "flag" some rows via native statements. Then we insert some rows via EntityManager from JPATemplate to this table. After that, we need to calculate changes in the table via native statement (with Oracle's union and minus, complex groups....

Spring - Populate form field with error message

I have a Spring 2.5 application and I have several forms where I perform various validation. I have no problem doing this validation and displaying the errors on the page next to the appropriate form input. I was wondering if I could instead put the error message in the form value so it displays in the input field instead of just in th...

How to transfer a file greater than 100mb using spring

How to transfer a file greater than 100mb using spring mvc. I have been through the post http://stackoverflow.com/questions/214888/how-to-handle-100mb-uploads-for-users, that tells to use ftp api. But want to know an alternative with spring. ...

how to resolve design issue in my App using Spring + iBatis

We use Spring + iBatis in all of our DAO's to fetch data from Stored Procedures. There are two main JNDI connections. one going to the datawarehouse and another going to livedb. recently lot of SPs have been moved from the livedb to the datawarehouse and vice versa. This is creating issues on the java side because: Now, each DAO d...

What is the best way to launch HSQLDB for unit testing, when working with spring, maven and hibernate?

In my project I can successfully test database code. I'm using Spring, Hibernate, HSQLDB, JUnit and Maven. The catch is that currently I have to launch HSQLDB manually prior to running the tests. What is the best way to automate the launching of HSQLDB with the technologies being used? ...

How to transfer attribute from several JSP pages to be displayed in a Tiles template page

I have a file pageLayout.jsp, where the basic structure of each page is laid out, including an HTML title. <title>Project Name</title> Instead of having a static title (like above), I would like to transfer the value of the title of each page to the template. For example, if the JSP page using the template has an H1 element displaye...

Struts 1 ActionForm - retrieving a collection from pure HTML

Hi all I have (just like the rest) inherited some struts 1 code. I have had need to add a few more pages to this project. What I cannot figure out is how to map several distinct but similarly natured input elements to my ActionForm. Let me elaborate. I create a new <Input> element dynamically as the user inputs more and more items (I ...

Can I use a property placeholder with Spring EL?

Before upgrading to Spring 3 I had this in my applicationContext.xml file: <bean class="com.northgateis.pole.ws.PolePayloadValidatingInterceptor"> <property name="validateRequest" value="${validateRequest}" /> <property name="validateResponse" value="${validateResponse}" /> </bean> where ${validateRequest) and ${va...

Can Spring understand @Inject replacing Weld as a JSR-299 implementation?

I have noticed from several web pages that apparently Spring 3.0 supports @Inject from JSR-330. As we would really like to use JSR-299 syntax for dependency injection in our libraries for both web apps and stand-alone applications, and have alternatives to Weld, it would be nice if Spring could do this. Being a novice to Spring, I trie...

How to enable Hibernate Interceptor when i have my Hibernate Transaction managed by Spring ???

If i have a @OneToMany relationship with @Cascade(CascadeType.SAVE_UPDATE) as follows public class One { private Integer id; private List<Many> manyList = new ArrayList<Many>(); @Id @GeneratedValue public Integer getId() { return this.id; } @OneToMany @JoinColumn(name="ONE_ID", updateable=fals...

TestConnectionOnCheckin c3p0 Configuration Property in Hibernate/Spring Framework

I would like to set the testConnectionOnCheckin property for c3p0. However I am having trouble doing so because the c3p0 datasource is created on my behalf within a hibernate entity-manager bean. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitM...

Preferred way of application initialization

Do you guys have your own little framework for project startups ? I mean, every time one needs to do the same things at the beginning: Context initialization - ideally after arguments are processed. Sometimes without interactive user input, sometimes with input reader. Sometimes we need to load properties, sometimes not. Then we need ...

flex blazeds spring exception translator

I am using spring exception translator to wrap java exception into flex exception. eg public void testException()throws Exception{ throw new Exception("my exception"); } But for some reason, I am getting IllegalAccessError. The code sections are entering the testException and the Translator class. Question: why it trying to g...

how to programmatically register an already setup bean to spring context

Hey, I'm wondering how one can do that. Afaik there is BeanFactoryPostProcessor interface that let us use BeanDefinitionRegistry.registerBeanDefinition() method before beans within context are initialized. That method accepts only a class / definition. But usually one needs to register a bean that is already set with properties. Otherw...

Any good Codeset/Code Value libraries and/or patterns?

I'm being forced to use code values for on-going projects and can't seem to find a good, eloquent solution besides brute force lookups for every code value. Are there any good libraries anyone can suggest, or any good design patterns to retrieve/swap code values? FWIW, I'm in a Spring/Hibernate shop. I had been using a @Codified annot...

Custom spring interceptor

Hi, I want to convert some of our internal API into a spring bean spring interceptor that we can use in other projects. This API needs some instantiation and other logic which I want to encapsulate in this bean so that we can just put the bean into our app context with necessary propoerties alone, and this will then apply the logic. I ...

Spring 3.0 MVC mvc:view-controller tag

Here's a snippet of my mvc-config.xml <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> <mvc:view-controller path="/index" view-name="welcome"/> <mvc:view-controller path="/static/login" view-name...

Tracking object in Spring Container

I have a question out of curiosity.. Is it possible to track object created and destroyed by Spring container? What I am thinking of is not logging but some kind of visual representation of objects life cycle. ...