The string is generated inside the Controller. What I want is to send back to the user a Window where he can save a file which contains the myString. It clearly doesn’t work in this current state and I am stuck at the moment. Answer here is a sample: PS: don’t forget to put some random stuff in your url
Tag: spring
How to perform batch update in Spring with a list of maps?
New to Spring, I am trying to insert a List<Map<String, Object>> into a table. Until now I have been using the SqlParameterSource for batch update, which works fine when a java bean is supplied to them. Something like this: However, I tried the same technique with a list of maps in place of a bean, it failed (rightly so). The
How can I apply aop on a whole package except one subpackage
Assuming my current package structure in a spring projects as : com.stackoverflow |- service |- entities |- controllers |- package1 |- package2 |-util How can I apply an aspect to all the …
What’s the difference between Spring Data’s MongoTemplate and MongoRepository?
I need to write an application with which I can do complex queries using spring-data and mongodb. I have been starting by using the MongoRepository but struggled with complex queries to find examples or to actually understand the Syntax. I’m talking about queries like this: or the use of JSON based queries which I tried by trial and error because
How do I test the JavaMailSender of Spring
I have a service that has injected the JavaMailSender. My service configures it and sends a mail. I’d like to intercept the raw mail to ensure the information is the correct. I’d like to do that in a JUnit. How would you guys do that? Answer I’ve done it using GreenMail. Take a look at my blog post about it
JDBCTemplate set nested POJO with BeanPropertyRowMapper
Given the following example POJO’s: (Assume Getters and Setters for all properties) One can easily query a database (postgres in my case) and populate a list of Message classes using a BeanPropertyRowMapper where the db field matched the property in the POJO: (Assume the DB tables have corresponding fields to the POJO properties). I’m wondering – is there a convenient
MySQL: Unknown system variable ‘tx_read_only’
I’m working on a Java Swing-based application+ Hibernate+Mysql+Spring. When I test CRUD operations, I don’t have problems with read, but in insert statements system shows the message: I have the last version of MySQl Hibernate 4 Java annotations Can you tell me which is the problem to solve now? Answer Just throwing rocks to the darkness, but one possibility could
Spring fails to inject entity manager factory
I writing tests for my DAO classes using JPA, with Hibernate as JPA provider, and Spring 3.2. I am not able to inject the entity manager correctly, I get a NullPointerException when trying to access it. My GenericDAO implementation looks like this: The class of the test looks like this: My root-context.xml is the following: I’ve tried several approaches without
How to pass two objects to use in a form using thymeleaf?
My problem is the following : I’ve 2 differents objects that I’ve to fill from a single form. With 1 object, I simply do in the newFoo.html: and in the FooController: Let’s say I’ve an other object bar with a “status” variable in it. How can I do to pass that object so I can submit the input within the
How to change Spring’s @Scheduled fixedDelay at runtime?
I have a requirement to run a batch job at a fixed interval and have the ability to change the time of this batch job at runtime. For this I came across @Scheduled annotation provided under Spring framework. But I’m not sure how I’d change the value of fixedDelay at runtime. I did some googling around but didn’t find anything