Latest Questions tagged Spring

Browse all latest questions tagged Spring

101
Votes
Published 07 Sep, 2022
Java - How to filter a PostgreSQL array column with the JPA Criteria API?

I am using: Hibernate 4.3.5 Spring JPA 1.6.0 Javax Persistence API 2.1 The "refcodemailing" column is defined as an array of int: int[] My entity object: @Entity @Table public class CalendarEven...

56
Votes
Published 26 Oct, 2022
Java - Logs are not loading according to Log4j2.properties

I am upgrading to Log4j to Log4j2 in my project. I have put log4j2.properties in the classpath, and its loading. Despite that logs are not coming according to properties defined in log4j2.properties....

87
Votes
Published 24 Oct, 2022
Java - POST array in RequestBody to Spring Controller as List of Objects

I'm fairly new to Spring, and I've looked at many posts about similar scenarios, but I have yet to figure this out. I'm trying to alter an existing (working) endpoint in my project to pass an array...

24
Votes
Published 19 Sep, 2022
Java - Connecting to Heroku Postgres from Spring Boot

I'm looking for the simplest, cleanest way of connecting to Heroku Postgres in a Spring Boot app using JPA/Hibernate. I don't see a good, complete example for this combo in either Heroku or Spring Bo...

72
Votes
Published 16 Sep, 2022
Java - org.mockito.exceptions.base.MockitoException: Please ensure that the type 'UserRestService' has a no-arg constructor

I want to create JUnit5 tests for Rest API. @Test public void resetRequest_NAME_AND_EMAIL_MISMATCH() throws Exception { when(userRestService.resetRequest(anyString(), anyString())).thenReturn(Boo...

35
Votes
Published 27 Aug, 2022
Java - bad value for type long: - Postgresql, Hibernate, Spring

I wanna store an entity(a String + an image) in PostgresQL using Spring MVC and Hibernate Here is my table. The image is supposed to be the type of oid. CREATE TABLE document ( name character varyi...

73
Votes
Published 06 Sep, 2022
Java - How to map Page<ObjectEntity> to Page<ObjectDTO> in spring-data-rest

When I hit the database with PagingAndSortingRepository.findAll(Pageable) I get Page&lt;ObjectEntity&gt;. However, I want to expose DTO's to the client and not entities. I can create DTO just by injec...

90
Votes
Published 30 Sep, 2022
Java - SSLHandshakeException: Certificate Unknown (Java Spring Boot & Android)

I have a Spring Boot API that runs locally, with a self-signed certificate, using the HTTPS protocol. Obviously, when I send GET Requests from the browser, I receive the io.netty.handler.codec.Decode...

11
Votes
Published 07 Sep, 2022
Java - how to capture connection event in my webSocket server with Spring 4?

I did a simple web socket communication with spring 4,STOMP and sock.js, following this https://github.com/rstoyanchev/spring-websocket-portfolio and this http://assets.spring.io/wp/WebSocketBlogPost....

52
Votes
Published 17 Oct, 2022
Java - javax.validation.constraints does not work with Spring web

Here is my controller: import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; @Slf4j @RestController @RequestMapping("/auth-api") public class AuthController {...

79
Votes
Published 07 Sep, 2022
Java - Spring: Generic RowMapper for dynamic queries

I am using SpringBatch to read from Oracle and write into ElasticSearch. My code works fine for static queries. Example: select emp_id, emp_name from employee_table I have a RowMapper class that maps...

58
Votes
Published 25 Aug, 2022
Java - How to PUT multipart/form-data using Spring MockMvc?

I have a controller's method with a PUT method, which receives multipart/form-data: @RequestMapping(value = "/putIn", method = RequestMethod.PUT) public Foo updateFoo(HttpServletRequest request...

122
Votes
Published 07 Sep, 2022
Java - Error: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain;charset=UTF-8' not supported

I'm newbie in Spring Data. I keep getting the error: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain;charset=UTF-8' not supported I've tried to change consumes ins...

27
Votes
Published 21 Aug, 2022
Python - Including Python Script in Spring Boot Application with Jython fails - module not found

I am trying to get used to python+java interaction and so I wrote a little python-script that I wanted to execute that script from my Spring Boot Application. That script is located in the (relative f...

129
Votes
Published 01 Sep, 2022
Java - How to return JSON data from spring Controller using @ResponseBody

Spring version 4.2.0, Hibernate 4.1.4 Here is my Controller function: @RequestMapping(value = "/mobile/getcomp", method = RequestMethod.GET) @ResponseBody public List&lt;Company&gt; listforCompanies...