spring

why use spring ??

hi, I am very much confused whether i should use spring Reason - I want to develop a loosely coupled code which i think can be developed using Factory pattern and interfaces... and dependency injection can be implemented without using spring too...(by passing parameters).. why should i use spring then ?? Which are the other benefits ...

Anonymous Spring bean

How is an anonymous Spring bean useful? ...

Spring incremental configuration using PropertyPlaceholderConfigurer

I'm trying to find a way to re-use a spring configuration. The component I want to reuse is working like that: The component is assembled inside the Spring context using a 'configBuilder'. The config builder is a bean that parse a string retrieved from a PropertyPlaceholderConfigurer to create a Config bean. The resulting config bean is...

Best practices question with Entities, service classes, and command objects.

Entity's are classes that map directly to our database (which we use for Hibernate). Our service classes contain business logic with these Entities before DAO is called. We also have Command Objects, which are POJO's that relate to specific views. I've been told that the Entities themselves shouldn't be used as command objects, but th...

how is spring better(sample code examples required)

Possible Duplicate: why use spring ?? could you please give me a very simple code example, showing how a code written in spring is very much easier as compared to a code written using interfaces and factory pattern ...

Spring aop transaction not committing the transaction

I am using Spring 3.0.3, MyBatis 3.0.2 and mybatis-spring 1.0.0 on Apache Tomcat 6.0.29. I have used declarative transactions of spring for transaction management. The issue is that the transactions are not working for me. The transaction only works once and thereafter nothing. I have tried checking all my configs but no clue. Any poin...

how resolve hibernate Envers Configuration Error?

Hi here i am using hibernate hbm file to all model class. Now I need to audit the details of that class. I tried to use hibernate envers. I had created a new class with @Audited annotation . Then i cofigured my hibernate.cfg.xml with my new class and Envers Configuration like <listener class="org.hibernate.envers.event.AuditEventListener...

Define a set outside of a bean in spring ioc

I understand that a set can be defined as: <bean id="toolbox" class="tools.Toolbox"> <property name="tools"> <set> <ref local="foo" /> <ref local="bar" /> </set> </property> </bean> but I can't find anything in the documentation to allow me to define the set first, for example: <set id=...

Is it possible to test the transactionality of a process?

I would like to be able to verify if each unit of work is done in its own transaction, or as part of a single global transaction. I have a method (defined using spring and hibernate), which is of the form: private void updateUser() { updateSomething(); updateSomethingElse(); } This is called from two places, the website when ...

Spring Instantiation and 'unused beans'

I'm working on a project which means customising an existing application (JasperServer 3.7.1) which is implemented in Spring 2.5.6 (plus a host of other Spring frameworks). The application consists of a host of applicationContext*.xml containing the bean definitions which when wired together by Spring bring the app to life - I think it'...

Copy gdata jars to root dir: `WEB-INF/lib` or to subdirs: `WEB-INF/lib/gdata/blogger/2.0`, etc?

I'm using Google's gdata library. I installed it in my local Maven repository because it is not available from Maven Central using a pom. I want to move it to my WEB-INF/lib directory so that I do not have to wait for the dozens of "Downloading" messages from Maven each time I restart the server. However, they are currently in a direct...

Solution for a jar file not findable in the `WEB-INF/lib` folder nor `src/main/resources` folder?

I have a Java application running on Jetty/App Engine/Spring. After removing some jar files from the pom and putting them in the WEB-INF/lib folder, they are no longer findable - I get numerous "Cannot find symbol" build errors. I also tried putting the jars in the src/main/resources folder - but the same outcome. How can I make thes...

spring / hibernate inheritance mapping InheritanceType.JOINED does not work with scenario A extends B extends C

Hi i am using Java 1.6 with hibernate and spring. I am having problems with hibernate models using inheritance mapping of type @Inheritance(strategy=InheritanceType.JOINED), or table per subclass. Scenario: we have 3 tables each mapped to a hibernate model each table shares the same single column primary key the java models extend eac...

Going from a form command to a stored entity with validation in a Spring 3 web app

I have a form to create a user and a corresponding command object. It looks like so: public class CreateUserForm { private String name; private String email; private String password1; private String password2; private Boolean enabled = true; ... getters and setters ... } I have a user entity object that is to ...

AnnotationSessionFactoryBean requires lucene classes. wtf?

I am trying to add transaction support to an existing webapp via spring transactions. i recently changed my session factory class from LocalSessionFactoryBean to AnnotationSessionFactoryBean. now i get the following error when the webapp starts: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tx...

spring folder content resource injected in bean

Hi, I need to pass a folder (java.io.File) as a function parameter. I tried to just declare the location of the folder, but it looks in SERVER_HOME (/home/user/tomcat). So my next try is to inject a File (directory) which is located in WEB-INF/myFolder. my first try failed: <bean name="path" class="java.io.File"> <constru...

Try to use hibernate 3.4 in JBoss 5.1 but gets javax.validation.ValidationException: Unable to find a default provider

I've come across some problems using Hibernate 3.4 on JBoss 5.1. Hibernate 3.4 is a JPA 1.0 implementation so it should be fine to be used in JBoss 5.1. The thing is JBoss has its own version of Hibernate, which is located at /common/lib whereas I don't want to use the version provided by JBoss. What I did was that I removed the hibernat...

Avoid 1 level cache issues while using @PersistenceContext(type=PersistenceContextType.EXTENDED)

I just configured @PersistenceContext(type=PersistenceContextType.EXTENDED) on my DAO classes to get lazy loading working on the view layer (needed to get it not closing the session for this) but I am having issues with 1 level cache (I imagine).. Because the object is cached even with my second level cache settings off. After turned off...

Using Spring 3 @ExceptionHandler with commons FileUpload and SizeLimitExceededException/MaxUploadSizeExceededException

Hi All, I am having trouble with catching and gracefully handling commons fileupload's FileUploadBase.SizeLimitExceededException or spring's MaxUploadSizeExceededException when uploading large files. From what I can tell these exceptions are thrown during data binding, before the controller is actually reached, therefore resulting in ...

RequestMapping for controllers for different servlets

Hi there, I have a problem with my spring controller/request mapping struture. In web.xml I have defined 2 dispatcher servlets, that map the following request paths: Servlet: /pathA/* Servlet /pathB/* All my controllers are defined in the package com.myproject.controllers, so both controllers serving for paths under /pathA...