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
Tag: spring-boot
Spring boot application won’t run when trying to run from the jar file
I have a spring boot application which works fine when run through intellij. But when I run it from the jar I am getting the below exception. Below is my pom file. I tried to create the jar by both and Then I run the jar by java -jar -DParamName=”someParam” What am I doing wrong here? I am new to
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
How to set logging.path for spring-boot apps?
spring-boot provides several logging.* settings that can be applied in application.properties, like: logging.level.=DEBUG logging.file=myfile.log logging.path=d:/logs/ Problem: myfile.log is …
Creating Pagination in Spring Data JPA
I am trying to implement pagination feature in Spring Data JPA. I am referring this Blog My Controller contains following code : My DAO is following : I am able to show first 20 records, how do I show next 20??? Is there any other pagination example that I can refer?? Answer I’ve seen similar problem last week, but can’t