実装ガイドとしてあってほしいもの

  1. はじめに 1.1. 利用規約 1.2. このドキュメントが示すこと 1.3. このドキュメントの対象読者 1.4. このドキュメントの構成 1.5. このドキュメントの読み方 1.6. 更新履歴
  2. TERASOLUNA Global Frameworkのアーキテクチャ概要 2.1. TERASOLUNA Global Frameworkのスタック 2.2. Spring MVCアーキテクチャ概要 2.3. はじめてのSpring MVCアプリケーション 2.4. アプリケーションのレイヤ化
  3. チュートリアル(Todoアプリケーション) 3.1. はじめに 3.2. 作成するアプリケーションの説明 3.3. 環境構築 3.4. Todoアプリケーションの作成 3.5. インフラストラクチャ層の変更 3.6. おわりに
  4. TERASOLUNA Global Frameworkによるアプリケーション開発 4.1. ドメイン層の実装 4.2. インフラストラクチャ層の実装 4.3. アプリケーション層の実装
  5. TERASOLUNA Global Frameworkの機能詳細 5.1. データベースアクセス(共通編) 5.2. データベースアクセス(JPA編) 5.3. データベースアクセス(Mybatis2編) 5.4. 排他制御 5.5. 入力チェック 5.6. ロギング 5.7. 例外ハンドリング 5.8. セッション管理 5.9. メッセージ管理 5.10. プロパティ管理 5.11. ページネーション 5.12. 二重送信防止 5.13. 国際化 5.14. コードリスト 5.15. Ajax 5.16. RESTfull Web Service (追加予定) 5.17. ファイルアップロード 5.18. ファイルダウンロード 5.19. Tilesによる画面レイアウト 5.20. システム時刻 5.21. ユーティリティ
  6. TERASOLUNA Global Frameworkによるセキュリティ対策 6.1. Spring Security概要 6.2. Spring Securtityチュートリアル 6.3. 認証 6.4. パスワードハッシュ化 6.5. 認可 6.6. XSS対策 6.7. CSRF対策
  7. Appendix 7.1. Blankプロジェクトから新規プロジェクト作成 7.2. NEXUSによるMavenリポジトリの管理 7.3. 環境依存性の排除 7.4. Project Structure Standard 7.5. 参考書籍 7.6. Spring Framework理解度チェックテスト

Propertyファイル読み込み

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:property-placeholder
        location="classpath*:/META-INF/spring/*.properties" />

</beans>

プロパティファイルの読み込み設定を行う。 src/main/resources/META-INF/spring直下の任意のプロパティファイルを読み込む。 この設定により、プロパティファイルの値をBean定義ファイル内で${propertyName}形式で埋め込んだり、Javaクラスに@Value(“${propertyName}”)でインジェクションすることができる。

【MYBATIS】mybatis generator

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration
 PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
 "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration>
  <context id="context1">
    <!--
      生成するクラスオブジェクトにタイムスタンプを付与するかどうかを設定します。
      value="true" の場合は生成しません。
 
      詳細は公式リファレンス参照
      http://mybatis.github.io/generator/configreference/commentGenerator.html
    -->
    <commentGenerator>
        <property name="suppressDate" value="true" />
    </commentGenerator>
 
    <!-- JDBCの設定 -->
    <jdbcConnection driverClass="org.postgresql.Driver"
                        connectionURL="jdbc:postgresql://192.168.100.100:5432/test" userId="mybatisuser"
                        password="password" />
 
    <!--
       Java Model(Entity)クラスの生成先を指定します。
       targetPackage : 生成先パッケージ
       targetProject : プロジェクトディレクトリから生成先パッケージの親ディレクトリまでのパス
 
       詳細は公式リファレンス参照
       http://mybatis.github.io/generator/configreference/javaModelGenerator.html
     -->
    <javaModelGenerator targetPackage="jp.hit.sample.mybatis.entity"
                        targetProject="src" >
    </javaModelGenerator>
 
    <!--
       SQL Mapperファイルの生成先を指定します。
       targetPackage : 生成先パッケージ
       targetProject : プロジェクトディレクトリから生成先パッケージの親ディレクトリまでのパス
 
       詳細は公式リファレンス参照
       http://mybatis.github.io/generator/configreference/sqlMapGenerator.html
     -->
    <sqlMapGenerator targetPackage="jp.hit.sample.mybatis.mapper"
                        targetProject="resource" />
 
    <!--
       Java Clientクラスの生成先を指定します。
       Java ClientはSQL Mapperファイルを呼び出すためのインターフェースクラスです。
       targetPackage : 生成先パッケージ
       targetProject : プロジェクトディレクトリから生成先パッケージの親ディレクトリまでのパス
 
       詳細は公式リファレンス参照
       http://mybatis.github.io/generator/configreference/javaClientGenerator.html
 
       type :
         type="ANNOTATEDMAPPER"
            アノテーションを定義したMapperインターフェースクラスとアノテーションの実装を定義したSqlProviderクラスを生成する。
            Mapperファイルは生成しない。
            Mapperファイルを使用せずにアノテーションでクエリを発行したい人向け
 
         type="MIXEDMAPPER"
            アノテーションを定義したMapperインターフェースクラスとMapperファイルを生成する。
            SqlProviderクラスは生成しない。
            Mapperファイルとアノテーションでのクエリ発行を両立したい人向け。
 
         type="XMLMAPPER"
            MapperインターフェースクラスとMapperファイルのみ生成する。
            SQLを全部Mapperファイルで管理したい人向け。
     -->
    <javaClientGenerator targetPackage="jp.hit.sample.mybatis.client"
                        targetProject="src" type="XMLMAPPER" />
 
    <!--
     自動生成対象のテーブル名を[tableName]に指定する。
     ※テーブル名の指定はワイルドカードが利用できます
 
     詳しい設定値については公式サイトのリファレンスを参照してください。
     http://mybatis.github.io/generator/configreference/table.html
 
     modelType :
       modelType="flat"
          ドメインクラスのみ作成。
       modelType="hierarchical"
          自動生成するMapperのパラメータの為にPrimary Keyエンティティを生成します。
          MapperでPKを指定したクエリ(selectByPrimaryKey等)のパラメータがデフォルトでPrimary Keyエンティティになります。
     -->
    <table schema="my" tableName="%"
            enableInsert="true"
            enableSelectByPrimaryKey="true"
            enableSelectByExample="true"
            enableUpdateByPrimaryKey="true"
            enableUpdateByExample="false"
            enableDeleteByPrimaryKey="true"
            enableDeleteByExample="false"
            enableCountByExample="false"
            selectByExampleQueryId="false"
            modelType="hierarchical">
    </table>
  </context>
</generatorConfiguration>

【SPRING】spring mvc のテンプレートエンジン

テンプレート一覧
エンジン 機能性 汎用性 記法 資料の充実度 パフォーマンス
JSP
Velocity
Freemarker
Thymeleaf
参考URL

http://www.thymeleaf.org/doc/Tutorial%20-%20Thymeleaf%20+%20Spring%203%2020130224.pdf Download - Thymeleaf: java XML/XHTML/HTML5 template engine