<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
>

<channel>
	<title>Solution Hacker &#187; configuration management</title>
	<atom:link href="http://www.solutionhacker.com/tag/configuration-management/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.solutionhacker.com</link>
	<description>This blog provides solutions for enterpreneurs!</description>
	<lastBuildDate>Mon, 06 Feb 2012 07:19:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=476</generator>
<!-- podcast_generator="Blubrry PowerPress/2.0.4" -->
	<itunes:summary>This blog provides solutions for enterpreneurs!</itunes:summary>
	<itunes:author>Solution Hacker</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.solutionhacker.com/wp-content/plugins/powerpress/itunes_default.jpg" />
	<itunes:subtitle>This blog provides solutions for enterpreneurs!</itunes:subtitle>
	<image>
		<title>Solution Hacker &#187; configuration management</title>
		<url>http://www.solutionhacker.com/wp-content/plugins/powerpress/rss_default.jpg</url>
		<link>http://www.solutionhacker.com</link>
	</image>
		<item>
		<title>Configuration Management and Monitoring via Spring</title>
		<link>http://www.solutionhacker.com/implement-your-idea/dev-process/monitoring-via-spring/</link>
		<comments>http://www.solutionhacker.com/implement-your-idea/dev-process/monitoring-via-spring/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 09:56:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Team]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[mbean]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/2008/01/25/monitoring-via-spring/</guid>
		<description><![CDATA[<h2><strong>Externalize your configuration from war</strong></h2>
<p>For settings that are going to change across different environments like database connection, you should externalize them from your war file. So, you can have your war be environment agnositic. Then, you can promote via simply copying your war across different environments. In Spring, there are several ways to achieve this.</p>
<h2><strong>What does Spring provide?</strong></h2>
<ol>
    <li>PropertyPlaceHolderConfigurer</li>
    <li>PropertyOverrideConfigurer</li>
    <li>Write your own ApplicationContext</li>
</ol>
<p>The first solutions you can get the detailed from <a href="http://blog.arendsen.net/index.php/2005/03/12/configuration-management-with-spring/">here</a>.  For the 3rd solution, you can subclass XmlWebApplicationContext and override the loadBeanDefinitions method.</p>
<pre class="java" name="code">
public class XmlWebApplicationContext extends
  org.springframework.web.context.support.XmlWebApplicationContext {

  private static ApplicationContextOverride eaco = new ApplicationContextOverride();
  protected final void loadBeanDefinitions(final XmlBeanDefinitionReader reader)
     throws IOException {

     ArrayList allLocations = new ArrayList(); // get standard locations
     String[] configLocations = getConfigLocations();
     allLocations.addAll(Arrays.asList(configLocations));
     allLocations.addAll(eaco.findFiles(configLocations));
     for (String apc : allLocations) {
       log.info("loading file: " + apc);
       reader.loadBeanDefinitions(apc);
     }
  }
}
</pre>
<h2><strong>What is JMX?</strong></h2>
<p>JMX is a technology that enables you to instrument applications for management, monitoring and configuration. Spring JMX module enables you to export Spring beans as <strong>Model MBean</strong> (ie dynamic) so that you can see inside your application and tweak the configuration even while the application is running.</p>
<h2><strong>How to expose your service as MBean in Spring? </strong></h2>
<p>To make your service configurable via JMX, you can follow the steps below:</p>
<ol>
    <li><em>Optional:</em> Create a MBean Server if there is no MBean Server instance in your environment. MBean Server is a container where MBeans live and through which the MBeans are accessed.</li>
    <li>Use MBeanExporter to expose/register your Spring beans as Model MBeans in an MBean Server. MBean in MBean Server will be identified by ObjectName. You can use jConsole or MC4J to visualize it.</li>
    <li>Optional: By default, all the public members of your Spring bean are exported as MBean operations and attributes. This is probably not what you want. Don't worry, you are given the power to select which attributes and operations to expose via MBeanInfoAssembler.</li>
</ol>
<p>&#160;</p>]]></description>
			<content:encoded><![CDATA[<h2><strong>Externalize your configuration from war</strong></h2>
<p>For settings that are going to change across different environments like database connection, you should externalize them from your war file. So, you can have your war be environment agnositic. Then, you can promote via simply copying your war across different environments. In Spring, there are several ways to achieve this.</p>
<h2><strong>What does Spring provide?</strong></h2>
<ol>
<li>PropertyPlaceHolderConfigurer</li>
<li>PropertyOverrideConfigurer</li>
<li>Write your own ApplicationContext</li>
</ol>
<p>The first solutions you can get the detailed from <a href="http://blog.arendsen.net/index.php/2005/03/12/configuration-management-with-spring/">here</a>.  For the 3rd solution, you can subclass XmlWebApplicationContext and override the loadBeanDefinitions method.</p>
<p><pre><pre class="java" name="code">
public class XmlWebApplicationContext extends
&nbsp;&nbsp;org.springframework.web.context.support.XmlWebApplicationContext {

&nbsp;&nbsp;private static ApplicationContextOverride eaco = new ApplicationContextOverride();
&nbsp;&nbsp;protected final void loadBeanDefinitions(final XmlBeanDefinitionReader reader)
&nbsp;&nbsp;&nbsp;&nbsp; throws IOException {

&nbsp;&nbsp;&nbsp;&nbsp; ArrayList allLocations = new ArrayList(); // get standard locations
&nbsp;&nbsp;&nbsp;&nbsp; String[] configLocations = getConfigLocations();
&nbsp;&nbsp;&nbsp;&nbsp; allLocations.addAll(Arrays.asList(configLocations));
&nbsp;&nbsp;&nbsp;&nbsp; allLocations.addAll(eaco.findFiles(configLocations));
&nbsp;&nbsp;&nbsp;&nbsp; for (String apc : allLocations) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.info(&quot;loading file: &quot; + apc);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.loadBeanDefinitions(apc);
&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;}
}
</pre></pre></p>
<h2><strong>What is JMX?</strong></h2>
<p>JMX is a technology that enables you to instrument applications for management, monitoring and configuration. Spring JMX module enables you to export Spring beans as <strong>Model MBean</strong> (ie dynamic) so that you can see inside your application and tweak the configuration even while the application is running.</p>
<h2><strong>How to expose your service as MBean in Spring? </strong></h2>
<p>To make your service configurable via JMX, you can follow the steps below:</p>
<ol>
<li><em>Optional:</em> Create a MBean Server if there is no MBean Server instance in your environment. MBean Server is a container where MBeans live and through which the MBeans are accessed.</li>
<li>Use MBeanExporter to expose/register your Spring beans as Model MBeans in an MBean Server. MBean in MBean Server will be identified by ObjectName. You can use jConsole or MC4J to visualize it.</li>
<li>Optional: By default, all the public members of your Spring bean are exported as MBean operations and attributes. This is probably not what you want. Don&#8217;t worry, you are given the power to select which attributes and operations to expose via MBeanInfoAssembler.</li>
</ol>
<p>&#160;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/implement-your-idea/dev-process/monitoring-via-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

