application.yml vs application.properties for Spring Boot

Well, they are just different data formats. Which one’s nicer and easier to read? That’s obviously subjective. Here’s a useful blog post. As far as spring-boot configuration is concerned, note that there’s only one documented shortcoming of using YAML. Per the documentation: YAML files can’t be loaded via the @PropertySource annotation. So in the case … Read more

Swagger TypeError: Failed to execute ‘fetch’ on ‘Window’: Request with GET/HEAD method cannot have body

I ran into this issue. Here is how I resolved it: I had a method like this: [HttpGet] public IEnumerable<MyObject> Get(MyObject dto) { … } and I was getting the error. I believe swagger UI is interpreting the Get parameters as FromBody, so it uses the curl -d flag. I added the [FromQuery] decorator and … Read more

Error “TestEngine with ID ‘junit-vintage’ failed to discover tests” with Spring Boot 2.2

I found the error. The dependency on spring-boot-starter-test brings a dependency on junit-vintage-engine. The latter must be excluded: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency>

Spring Boot Unit Test ignores logging.level

Okay what I did now, in all modules I configured as follows: src/main/resources: I use logging configuration in application.properies like logging.level.* as described in the question. src/test/resources: I use logback-test.xml like: <?xml version=”1.0″ encoding=”UTF-8″?> <configuration> <include resource=”org/springframework/boot/logging/logback/base.xml” /> <logger name=”*.myapp” level=”error” /> <logger name=”org.springframework.core ” level=”error” /> <logger name=”org.springframework.beans” level=”error” /> <logger name=”org.springframework.context” level=”error” /> … Read more

@ConfigurationProperties Spring Boot Configuration Annotation Processor not found in classpath

I had the same problem. I use idea 2017.2 and gradle 4.1, and some blog said you should add: dependencies { optional “org.springframework.boot:spring-boot-configuration-processor” } But I changed it to this: dependencies { compile “org.springframework.boot:spring-boot-configuration-processor” } And the warning is gone.

Difference between using MockMvc with SpringBootTest and Using WebMvcTest

@SpringBootTest is the general test annotation. If you’re looking for something that does the same thing prior to 1.4, that’s the one you should use. It does not use slicing at all which means it’ll start your full application context and not customize component scanning at all. @WebMvcTest is only going to scan the controller … Read more

Disable Logback in SpringBoot

Add exclusion to both the spring-boot-starter and spring-boot-starter-web to resolve the conflict. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)