spring

Building arbitrary ditributions from Maven Project containing several and optional modules

Hi Stackoverflow, first of all: my Maven knowledge is limited so please bear with me. ;-) I have a simple Maven Project currently consisting of three modules. The module containing the core of the application is called core (Creative name, huh? :-)) and the other modules are basically plugins for this core module. There is one restricti...

Apply dynamic properties to a bean at runtime

Assume I have a bean DialogBox, with properties for height and width: public class DialogBox { int x; int y; ... } In my applicationContext.xml I would define properties as reasonable defaults: <bean id="dialogbox" class="DialogBox"> <property name="x" value="100"/> <property name="y" value="100"/> </bean> We have multiple c...

Can't find service because OSGi bundle isn't activated

I'm having a problem discovering services that are provided by some OSGi bundles that are not being activated. Let me describe the situation: Bundle A defines interface X Bundles B, C, and D provide services that implement interface X These bundles' services are registered via Spring DM, so they are only created when the bundle is ac...

Infinite loop using Spring Security - Login page is protected even though it should allow anonymous access

I have a Spring application (Spring version 2.5.6.SEC01, Spring Security version 2.0.5) with the following setup: web.xml <welcome-file-list> <welcome-file> index.jsp </welcome-file> </welcome-file-list> The index.jsp page is in the WebContent directory and simply contains a redirect: <c:redirect url="/login.htm"/> In the ...

generic dao architecture discuss-best prastice

i thinking of doing this architecture genericdao +interface ---> servicelayer+interface---> view layer my dao will only have generic methods, my service layers will have real logic for instance service layer method string executeThis= "select c from com.abc.test.User where username =:username"; Map tempMap = new HashMap(); tempMap...

transactionmanager using same datasource

(connected to db call abc)--->datasource1 ---> LocalSessionFactoryBean --->transactionManager1 (connected to db call abc)--->datasource1----->AnnotationSessionFactoryBean -->transactionManager2 the reason i have 2 sessionfactory is because one is used by 3rd party osworkflow library and latter use by my application since both are co...

Spring configuration for embedded H2 database for tests

What does your Spring configuration for a datasource with embedded h2 database that you use for integration (JUnit-)tests look like? My first try with a SingleConnectionDataSource basically worked, but failed on more complicated tests involving suspended transactions. You might start h2 in tcp based server mode as well, but this is proba...

How to check if my transactional methods really support transactions?

I'm using Spring 3.0, and I have a set of methods like this: @Transactional (value = "authTransactionManager") public void remove(User user) { ... } I use 2 different transaction managers and specify necessary manager (authTransactionManager in example above). I was curious what would happen if I specify nonexistent manager. I ...

NoClassDefFoundError in spring

Hello, I wrote a Spring application which runs on Weblogic 10.3. In this application I have some JMS Queue consumers. Sometimes I got an error when the application is closing or opening (I saw this error in both situation) saying: java.lang.NoClassDefFoundError: org/springframework/jms/connection/SmartConnectionFactory at...

Spring JMS TransactionRolledBackException

Hello, In my Spring web application which consumes a JMS Queue, I got this error: Setup of JMS message listener invoker failed - trying to recover: weblogic.jms.common.TransactionRolledBackException: Attempt to resume an inactive transaction: BEA1-00059419F3D97B75FA98:error resuming transacted session's internal transa...

How to ensure that methods called from same thread use the same DB session

In our system we have multi-threaded processing engine. During processing each thread calls methods to retrieve data from the database. We determined that performance is greatly improved if methods called from the same thread use the same DB session (sessions are coming from the pool of course). Is there any standard way in Spring to e...

Is it possible to reuse the pre-defined controllers in spring annotation configured mvc projects?

Is it possible to reuse the predefined controllers, like the SimpleFormController, with annotation configured spring mvc projects? I downloaded a project that looks like what I want; however, the writer did not use the annotations that are predefined in Spring. The controller of the downloaded project: package net.sourceforge.sannotat...

creating inner classes with spring

What is the best aproach to create a non-static inner class in Spring? class A { public class B {} B b; public void setB(B b) {this.b = b;} } this seems to work, but i want to avoid the need for a constructor argument: <bean id="a" class="A"> <property name="b"> <bean id="b" class="A$B"> <constructor-arg ref="a"/> ...

DB backup problem with Spring/Hibernate GenerationType.AUTO

Hi, I work with Spring/Hibernate Dao's for saving my Object in the Database. Now I had to backup all my DB inside my application. Now when I try to read my backup back, my application crashed. Now I found the problem for this crashing. It's Hibernate it creates automaticly a new ID for my Object when I want to save. For example I save...

Spring Annotations not working

I posted this to the spring forums, sorry for the xpost. I am new to spring. I am working on an existing project that uses spring 1.2.8 (old, I know), and java 1.5 so annotations should work. I am trying to use the @Transactional annotation on a concrete class, following the docs at: http://static.springsource.org/spring/docs/1.2.8/ref...

Spring form not submitting

I am using Spring SimpleFormController for my forms and for some reason it won't go to the onSubmit method Here's my code: public class CreateProjectController extends SimpleFormController { ProjectDao projectDao; public CreateProjectController() { setCommandClass(Project.class); setCommandName("Project"); setSessionForm...

Have multiple submit buttons in a form and determine which was pressed in a controller

In my Spring application, I have a jsp that has a form where I want to have multiple submit buttons that go to the same controller. I need to be able to determine which button was pressed in the controller. The form displays a number of items to the user and they can select one of the items with the only difference being the ID of the ...

Spring - Show dynamic errors based on specific form field

In my Spring application, I have a form that has multiple inputs of the same field (the user can enter several user names at once). In the validator, I check for the existance of each user name and I want to show an error on the form next to each invalid user name. I can set an error in the validator that will show on the form, but thi...

integrating springMVC and extjs

I am using springMVC and hibernate in my current j2ee project. The view as of now consists of plain jsp, with JSTL to make things a bit simple. Looking at the extjs project, I believe it can be used as a substitute for the view. I have been looking at the extjs docs but frankly, I am not sure how to integrate it in spring. Does anyone ...

What's the difference between Spring BeanFactoryAware and ApplicationContextAware?

Both can be used to get bean instance, but which one is better to be used to implement? ...