tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miles Daffin" <>
Subject Re: System properties
Date Mon, 20 Nov 2000 11:45:42 GMT
Hi guys,

> > From the looks of things, it is just the way it is, although I was
> > the there would be some way to put stuff in the web.xml file, maybe in
> > servlet tag like:
> >
> > <system-property>
> > <name>myproperty</name>
> > <value>42</value>
> > </system-property>
> >
> > Anyone think this is a good idea, or am I talking rubbish?
> It's a bad idea.  Keep your web-apps encapsulated.

Why would such a move, if it were possible, break encapsulation?

As long as this property value is never broadcast
i.e. System.setProperty("myProperty", "42");

If you want application local properties then simply create a class to hold
with a static method for obtaining them from anywhere in your app (like

Have a Servlet initialize these by passing it the location of a properties
file containing the
props you need as an initialization parameter. This Servlet can be loaded on
load in the properties, and there you are, unless I have completely

Check out the API for java.util.Properties#load(InputStream in)

> There is two ways to think about a "global" service:
> - providing a service to many servlets, seems like a good thing
> or
> - bleeding out dependencies upon those that don't need them and allowing
> access to those that shouldn't be using it.  bad things

What is 'bleeding out dependencies'? Please explain.

> > PS. static, bad?  It is useful! ...
> she said and meant _static initializers_ = bad, not static methods, and
> members.  I concur.

Why are static init blocks || methods bad?
Under what circumstances? In a Servlet context?

Please explain.


View raw message