Himanshu Goyal
Himanshu Goyal

Reputation: 71

Is classpath per spring application context or per JVM?

Consider I have two Spring projects that have the same filename inside the classpath. For example:

SpringProject-1 : @PropertySource(value = "classpath:database/abc.properties") and abc.properties has "name"="abc"

SpringProject-2 : @PropertySource(value = "classpath:database/abc.properties") and abc.properties has "name"="Xyz"

Now, these projects are created as jar(s) and are added into third spring project, let's say the main-spring-project.

Now, if I want to access the classpath from the main-spring-project, shall I expect conflict in the properties(i.e having either "name"="abc" or "name"="Xyz") or shall I get separate abc.properties for each project(i.e one abc.properties for springProject1 and one for springProject2)

Is classpath is per spring-context or per JVM context?

Upvotes: 0

Views: 165

Answers (1)

ControlAltDel
ControlAltDel

Reputation: 35096

Classpath is JVM specific. If you have multiple Spring instances running on a single JVM, then they will all share the classpath. However if they are running on multiple JVMs, they will have their own classpaths

Upvotes: 1

Related Questions