I have checked similiar questions:
Spring Boot: @Value returns always null
Yet, I cannot find what is wrong with my annotation
This how the code looks in IntelliJ screenshot from IntelliJ
This is whats beneath
@Component
public class VisitMapper {
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.username}")
private String username;
@Value("${spring.datasource.password}")
private String password;
//more code below
I have two .properties files: application-dev.properties and application.properties. Active profile is set to dev. In application-dev.properties I have:
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=postgres
Not sure if it is important since active profile is set to dev, but in application.properties I have:
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
To sum up - why is password value shown as empty?