If instances of Config are being instantiated manually via new then Spring isn't getting involved, and so the annotations will be ignored If you can't change your code to make Spring instantiate the bean (maybe using a prototype scoped bean), then the other option is to use Spring's load-time classloader weaving functionality (see docs ). This is some low-level AOP which allows you to instantiate objects as you normally would, but Spring will pass them through the application context to get them wired up, configured, initialized, etc It doesn't work on all platforms, though, so read the above documentation link to see if it'll work for you.
If instances of Config are being instantiated manually via new, then Spring isn't getting involved, and so the annotations will be ignored. If you can't change your code to make Spring instantiate the bean (maybe using a prototype-scoped bean), then the other option is to use Spring's load-time classloader weaving functionality (see docs). This is some low-level AOP which allows you to instantiate objects as you normally would, but Spring will pass them through the application context to get them wired up, configured, initialized, etc.It doesn't work on all platforms, though, so read the above documentation link to see if it'll work for you.
Thanks for the advise... The issue is that I'm instantiating Config from a JSP. I'm not sure if I can find a way around that? Maybe by using some sort of factory?
– Polaris878 Nov 9 '10 at 16:12 @Polaris878: My suggestion should still work for JSP-instantiated objects (any any object instantiated via reflection) – skaffman Nov 9 '10 at 16:50 +1. I seize to know about Spring in that detail. Didn't touch it for years.
Stupid workplace. – Adeel Ansari Nov 10 '10 at 2:25.
As its working with @Controller, it seems you are instantiating Config yourself. Let the Spring instantiate it.
Ahhh yeah that is the problem... I'm calling the constructor myself. How then, could I access these properties? If I can't access these properties, that basically means I need to find some other way to load configuration, as the Spring properties loader just won't cut it if those properties are only available in certain scenarios.
– Polaris878 Nov 9 '10 at 5:04 @Polaris878: Let the Spring instantiate it. Do we have any issues with that? Or do it yourself using ResourceBundle.
– Adeel Ansari Nov 9 '10 at 5:07.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.