spring

Mixing Annotated and Normal Controllers at Spring MVC 2.5

Hi All, I just recently learned about spring mvc but the tutorials that I have seen uses concrete framwework controllers. (SimpleFormCOntroller/AbstractController..etc) As I know, they were deprecated in Spring MVC 3.0 right now. As I have been reading on the forum, they say that annotated controller are flexible than the one that ext...

ActiveMQ single consumer multiple producers

hi guys, can anybody point out a reference on how to implement a single consumer multiple producer in activemq Or could give a very simple implementation this will be very helpful. tnx ...

Multiple SpringDispatcherServlet to handle different url

Is it ok to have more than 1 DispatcherServlet in web.xml to handle different URL ? What's the downside? <servlet> <servlet-name>servlet1</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>servlet2</servl...

Struts2: custom action mapper defined in Spring

I have following situation: I use Struts2 as MVC cobtroller I use Spring as object factory I implemented custom action mapper, I have configured this as a bean in my spring configuration. How can I tell Struts to use this bean as an action mapper? I tried top set: struts.mapper.class=beanName in struts.properties but this does...

Access to User ID in Spring

Hi I'm doing some proof-of-concept work with Spring MVC and security. So far I've managed to write a simple web-app which has a secure webpage which requires a user to login and have the correct role before accessing the database and listing some data. I'm using Spring 2.0.8 by the way. What I require is that, after the user has logged o...

Bypass GeneratedValue in Hibernate (merge data not in db?)

My problem is the same as described in [1] or [2]. I need to manually set a by default auto-generated value (why? importing old data). As described in [1] using Hibernate's entity = em.merge(entity) will do the trick. Unfortunately for me it does not. I neither get an error nor any other warning. The entity is just not going to appear i...

Declaratively caching returned values of bean methods with Spring

I have a couple of beans defined with java @Configuration. Some of them have methods perform pretty long calculations and I'd like to cache returned values for given arguments to avoid making those calculations every time a method is called. Example: @Configuration public class Config { @Bean public CalculatorBean calcBean() { ...

Spring aop with struts2

Hi all, I am new to Spring aop and I decided to use aop to track my Struts2 Action class execution time. I have done the following things. But while running the application setter method of the action class is not called. Here is my code. xml configuration: <aop:aspectj-autoproxy/> <bean id="myAspect" class="abc.xyz.ActionClassAspect"...

Spring 3.x - Will it play in App Engine ?

Spring 3.x is conspicuously absent from the official Will it play in app engine? Has anybody got it up and running? Any issues with the following? Fully annotated controllers? Annotated JSR 303 validation? ...

How to display buildnumber in spring-based web application

I need to display build number in my index.jsp page <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8" /> <title>Title (build: BUILDNUMBER ) </head> The build number can be supplied by maven into a *.properties file. What is the best way to read *.properties file and display a property with Spring? ...

Spring + App Engine + JSR303

I am new to Spring and having issues with JSR303 Validation. The problem appears to be with the <mvc:annotation-driven/> tag in spring-servlet.xml. When I include this tag I get the following error on startup of the development server. SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Er...

CXF SSL Spring configuration - Empty client certificate chain

Hi everybody, I am trying to build a SSL secured Web Service client using CXF Spring configuration and I wonder how is it possible to tell to CXF to use this client certificate in my keystore. This should exists because if my keystore holds plenty of certificate how does CXF is supposed to do to find the good one? Here is my configurat...

Problem with @OneToMany annotation with Spring Roo

I'm trying to use Spring Roo to generate entities with a @OneToMany unidirectional relationship. Here's what I've tried: entity --class ~.family.Child field string --fieldName name controller scaffold ~.web.ChildController entity --class ~.family.Father field string --fieldName name field set --fieldName children --element ~.family.Chi...

Spring JmsTemplate + Security

I've just refactored some code that published to a JMS topic to use Spring's JmsTemplate class and now I'm receiving an exception stating I'm not authenticated. Previously I created the factory, made a connection, then session etc as follows: MQTopicConnectionFactory factory = new MQTopicConnectionFactory(); factory.setQueueManager(qMg...

Problem on JPA: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

Hey there everyone ... I´m using JPA with SPRING and mySQL and I´m having problems while removing an entity... I am doing this: @PersistenceContext private EntityManager em; ... @Transactional public void delete(Long id) { em.flush(); OwnerEntity e = em.getReference(Entity.class, Long.valueOf(id)); if (e == null) throw new Ex...

How to set a role in DataSource from Spring

Hi, I have to use a default Role so that after the datasource has been defined and connected that role will allow me to use select statements. I know its little weird but I have to do it due to security concerns. So here is the code in my Spring's applicationContext.xml: <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSou...

How to create reusable components in Spring MVC 3.0

Ok I really don't know where to start. I have been trying to develop reusable component-like pages in Spring MVC. I ended up using tiles. I had the idea from "Spring in action" book on writing ComponentControllerSupport class. But the problem starts with tile2 and spring 3.0. All old features of tile1 is deprecated and tile2 has changed ...

Spring Test Framework and annotation-based autowiring Problem

Hi I would like to use two different implementations for a DAO with Spring's testframework. src.main.java .businessobjects \-User.java .dao \-IUserDAO.java .daojpa \-UserDAO.java .daohibernate \-UserDAO.java The spring testcase in: src.test.java.base: package base; import org.junit.runner.RunWith; import org.springfr...

Spring/Hibernate testcase error

I am using spring and hibernate and currently making test case for database test and i am getting this error Error: Before Test CaSe SEVERE: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1e91a4d] to prepare test instance [com.Test.TestClass@bdc9b3...

Integrate existing Spring based web application with a CMS

We have stable spring based (spring 2.x) web application. We have a new requirement which is our data entry operators should be able to login to some kind of an admin module and simply change the text in the web pages, change the color etc. I have seen PHP based CMS’s that allows authorized user to change the content in WYSIWYG manner. ...