Skip to content
Advertisement

Tag: spring-boot

Gradle project error – java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication

This is my main application code: I’m using gradle to build the project. Even though SpringApplication file is properly imported I’m getting the following error: I’m getting following gradle message when I hover over SpringApplication Any help would be much appreciated. Thanks in advance! Answer The error was because of an issue with gradle 3.4 I’ve changed my gradle distribution

Creating strict mock when using @MockBean of spring boot?

I use @MockBean of spring boot (with @RunWith(SpringRunner.class)) and everything was ok so far. However the mock provides default implementation for every method of the mocked class so I cannot check if only those methods were called that I expected to be called, i.e. I would like to create strict mock. Is that possible with @MockBean? I don’t insist on

ConfigurationProperties does not bind properties

I want to bind my application.properties into a class automatically by using @ConfigurationProperties annotation. First, I tried with @Value annotation and was able to inject property values into class variables. However, @ConfigurationProperties did not inject properties into values. my application.properties: application.java ConfigBinder.java output: What is the wrong with this implementation? edit and solution: possible duplication: Spring Boot @ConfigurationProperties not retrieving

How to return a set of objects with Spring Boot?

I did a lesson about Spring Boot and it works perfectly. But what if I want to return a set of objects ? I tried doing this but it doesn’t work. How can I do it correctly ? With one object (it works): With many objects (it doesn’t work): Answer If you compare your original method to your newly made

How to specify UTC timezone for Spring Boot JPA Timestamp

Environment Spring Boot Starter Data JPA 1.4.2 Eclipselink 2.5.0 Postgresql 9.4.1211.jre7 Problem I am building a Spring Boot microservice that shares a Postgresql database with a different service. The database gets initialized externally (out of our control) and the datetime column type used by the other service is timestamp without time zone. Therefore, since I want all dates on the

How to set IgnoreCase on sort parameters from an http request in Spring Boot 1.4

I have a Spring Boot backend running and accepting HTTP requests. Example: http://www.myserver.com/devices/ I’m using Pageable to handle the requests and automatic Pagination and Sorting, so I’m able to use requests like: http://www.myserver.com/devices?sort=name,desc There is an issue however, that the sort if case sensitive, and thus the desired sorting result (case insensitive sorting) is not obtained. I know Pageable Sort

Handle Security exceptions in Spring Boot Resource Server

How can I get my custom ResponseEntityExceptionHandler or OAuth2ExceptionRenderer to handle Exceptions raised by Spring security on a pure resource server? We implemented a so whenever there is an error on the resource server we want it to answer with The resource server uses the application.properties setting: to authenticate and authorize a request against our auth server. However any spring

Advertisement