I have a service with one method: And I’m running Gatling with 2 parallel calls config with testModelId = 1L argument. As a result of these calls I’m getting error: What I can see from logs is that two calls have entered this method at once and each printed log I assumed that adding transaction annotation on this method would
Tag: spring
Jackson deserialization issue for ZonedDateTime
I’ve the following field in a class I use during deserialization of a service that I’m consuming. The service I’m consuming may return a Date or DateTime using the pattern: yyyy-MM-dd’T’HH:mm:ss.SSSZ Let me give 2 examples of what the service returns: 2015-11-18T18:05:38.000+0200 2015-11-18T00:00:00.000+0200 While first one works well, the latter causes the following exception to be thrown during deserialization: java.time.format.DateTimeParseException:
Mapping java.lang.String type to Postgres JSON Type
My question is related to the following question Mapping postgreSQL JSON column to Hibernate value type and although the answer works when I test passing a string to psql in postgres it doesn’t work when passing a string from my Java code. I am using MyBatis to map sql to the postgres database via Spring injection. Here is my Java
How to re-create database before each test in Spring?
My Spring-Boot-Mvc-Web application has the following database configuration in application.properties file: this is the only config I made. No any other configurations made by me anywhere. Nevertheless the Spring and subsystems are automatically recreate database on each web application run. Database is recreated namely on system run while it contains data after application ends. I was not understanding this defaults
Error java.lang.AssertionError: expected: null but was: java.lang.String what does it mean?
I have this strange issue in my Junit 4.12 test code. The application uses Spring Framework 4.1.6 and Hibernate 4. When comparing two beans coming from different databases I get this error What does it mean? How to resolve it? My test class runs with SpringJUnit4ClassRunner and looks similar to this edit: the bean I’m referring to is a simple
Difference between @Bean and @Autowired
Why can’t I use @Autowired in this case? but can use @Bean Aren’t the two ways to generate BookingService the same thing? Answer @Bean and @Autowired do two very different things. The other answers here explain in a little more detail, but at a simpler level: @Bean tells Spring ‘here is an instance of this class, please keep hold of
loadOnStartup SEVERE: Servlet [dispatcher] in web application [/Producer] threw load() exception java.lang.NoSuchMethodError
I have a problem with setting up spring context using Eclipse + tomcat 8. I have checked several “Hello world” spring manuals and do not understand what is going wrong. I have the following error in console: Answer Somewhere in your classpath you have old Spring lib. AnnotationUtils from 4.2.1 contains rethrowAnnotationConfigurationException But in spring 3.2.5 – no such method
Reading excel file columns based on header in Spring Batch
We have requirement to read the huge excel file in java. I am prefering Spring Batch for same ,as we have spring already in project. However, we have one bottleneck that this excel file can have different columns, user can change the order of columns . So, we have to identify which column has what data from first row /
spring combine two validation annotations in one
I’m using Spring+Hibernate+Spring-MVC. I want to define a custom constraint combining two other predefined validation annotations: @NotNull @Size like this: and I want to use this annotation in my form models. UserController.java But it does not work. It accepts the less than 4 character passwords. How can I solve this problem? Answer This is a bit late, but technique of
How to mock a autowired list of Spring beans?
I’ve read plenty of articles about how to mock Spring’s bean and their autowired fields. But there is nothing I could find about autowired lists of beans. Concrete problem I’ve a class called FormValidatorManager. This class loop through several validators which implements IFormValidator. I would like to test this class. But I can’t find a way to mock validators property.