Skip to content
Advertisement

Tag: spring-boot

Overriding beans in Integration tests

For my Spring-Boot app I provide a RestTemplate though a @Configuration file so I can add sensible defaults(ex Timeouts). For my integration tests I would like to mock the RestTemplate as I dont want to connect to external services – I know what responses to expect. I tried providing a different implementation in the integration-test package in the hope that

Spring Boot @ExceptionHandler hide Exception Name

I am using Spring Boot 1.3.X and have the following: Which works as expected. When passing a wrong param, the following exception is raised: I then created an ExceptionHandler as seen below: Which raises the following Exception: Is it possible to exclude the exception field from the JSON representation? Answer You can get the Error Attributes in your controller advice

Does Spring Boot support multimodule maven projects?

I’m just curious about the level of support Spring Boot has for multimodule maven projects. There’s so much work that has to be done when creating a good layered set of projects (especially getting the various JPA/JDO enhancers set up). All of the samples I’ve seen put everything into one project, which is fine for simple demos. Can Spring Boot

Scheduler not running in Spring Boot

I have created a Spring Boot application. I have configured my class that contains the scheduler method startService(). Below is my code : Service Class : Main Class : I have annotated the class as @Component and also method as @Scheduled(fixedRate = 30000) that will running as a scheduler. But while running the application as Spring Boot the scheduler does

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

Spring Boot classpath

In the Spring Boot’s docs here, about serving static content, it says: By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath. I found that all the content in the directory: will be copied inside the classpath, so I can put my static content in: and all will

Serving HTML pages in a Spring Boot application

I have a Spring Boot Application. I am trying to pass a variable to a HTML page but unfortunately I cannot seem to do it, on application start nothing is rendered except the static text: “WORLD”. My controller is as below: And my index.html: I was looking for an answer and I found these articles: How to serve .html files

Advertisement