UPDATE: I\'ll still keep Artem Bilan\'s answer marked as correct, but I still felt I needed to point this out for any future readers. It seems I was misundersta
You show src -> main ->
etc., but that doesn't matter for runtime.
If you really are going to have that file in the final application (jar? war?), be sure that you pack that file really as a part of the final application.
And share that structure here.
With Spring Java & Annotation Configuration you don't need to worry about ClassPathResource
object. There is just enough to declare it like this in the appropriate @Configuration
:
@Value("com/my/package/name/privateKey.txt")
private Resource privateKey;