dimanche 2 octobre 2016

Using properties files in spring-boot tests

I have simple spring boot web service, where for configuration I use .properties files. As example for spring-mail configuration, I have separate file mailing.properties located in src/main/resources/config/ folder.

in main application I include it using:

@PropertySource(value = { "config/mailing.properties" })

The problem appears when it comes to tests, I would like to use the same properties from this file, but when i try to use it, I get fileNotFaundExeption.

Question is:

  • Should I have separate resources in my src/test folder, or it is possible to access resources from src/main folder, if yes, how?

Aucun commentaire:

Enregistrer un commentaire