de.smartics.properties.tutorial.config.key
Class NoConfigurationKeyTutorial

Package class diagram package NoConfigurationKeyTutorial
java.lang.Object
  extended by de.smartics.properties.tutorial.config.key.NoConfigurationKeyTutorial

@Document(title="No Configuration Key Required",
          sortKey="basics1020")
@DocCategory(value="basics")
public class NoConfigurationKeyTutorial
     
     
extends Object

This tutorial shows how to use plain properties files and access it with a generic configuration key. This is a solution to choose if you just want to use the annotation stuff but do not bother with different configuration keys.


Constructor Summary
NoConfigurationKeyTutorial()
           
 
Method Summary
 void accessConfigurationByHardcodedKey()
           In this example we assume that there are multiple modules in a single application, but there is no need to handle different configurations.
 void setUp()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoConfigurationKeyTutorial

public NoConfigurationKeyTutorial()
Method Detail

setUp

public void setUp()

accessConfigurationByHardcodedKey

@DocChapter
public void accessConfigurationByHardcodedKey()

In this example we assume that there are multiple modules in a single application, but there is no need to handle different configurations. Accessing properties provided to the application via annotations is simply everything that is required. We show that you do not have to bother with configuration keys since everything that is required to appease the system is done automatically behind the scenes.

The following modules are declared as dependencies to the application:

     
     
     
       
      
      
       
       de.smartics.sandbox
      
      
       
      
      
       
       test-module-mail
      
      
     
     
     
     
     
     
       
      
      
       
       de.smartics.sandbox
      
      
       
      
      
       
       test-module-announce
      
      
     
     
     
 

The definition for these properties is provided by a dependency like this:

     
     
     
       
      
      
       
       de.smartics.sandbox
      
      
       
      
      
       
       test-application-config-nokey
      
      
     
     
     
 

At we create the default configuration. This configuration holds all property definitions that are not associated to a particular key.

At and we only show that accessing the properties really show the values from the definition files.



Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.