2.7. Setup with DICON file

Let's set up the before-mentioned all setting by DICON file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container//EN" "components21.dtd">
<components>
    <component class="Action"/>
    <component class="Service">
        <aspect pointcut="/^add$/">trace</aspect>
    </component>
    <component class="Dao">
        <aspect pointcut="/^findById$/">trace</aspect>
    </component>
    <component class="seasar\aop\interceptor\TraceInterceptor" name="trace"/>
</components>

Reading of the DICON file is performed by the s2import function. Requiring of the classes of the classes directory is performed by the import method of seasar\util\ClassLoader class.

<?php
require_once('S2Container.php');
use seasar\util\ClassLoader as s2loader;

s2loader::import(dirname(__FILE__) . '/classes');
s2import(dirname(__FILE__) . '/quickstart050.dicon');

$action = s2get('Action');
$action->indexAction();
[Note]NOTE

This Example is located at "examples/quickstart/quickstart050.php".



© Copyright The Seasar Foundation and the others 2005-2010, all rights reserved.