This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

why can't spring be aware of my changes of the config filePage Title Module

why can't spring be aware of my changes of the config file

Sep 29th, 2004, 11:46 AM

Hello All.

I come up against a very strange problem! spring can't be aware of my changes of the config files when I run unittest with ant. I must run a main
function in which I get some beans by ApplicationContext from config file. I can only notify my application that my config files have been change in this way! Why is there such a strange thing!

Because the problem is so strange so I don't know what info must I supply to you!

Comment

I am not clear on what you mean by Spring waking up... Spring will not cache anything, although certainly a static var like you are using will end up caching a context while that class is still in memory.

Are you running ant from command-line or from within your IDE? In either case, a new invocation of the test would end up loading a new vm and a new instance of the context, with your code. If you are running multiple tests at the same time, then in some IDEs the IDE will not fork for each TestCase (which is why I think you are using the static in the first place), but the first test will trigger loading of the context. Spring does not and can not 'cache' information between different VM invocations. If you are getting cached data with your setup in the same VM invocation, it is becaue you are keeping your 'BeanLocator' class in memory...