<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/spring_atoz/">
    <title>Spring Framework 初心者向け wiki</title>
    <link>http://w.atwiki.jp/spring_atoz/</link>
    <atom:link href="https://w.atwiki.jp/spring_atoz/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>Spring Framework 初心者向け wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2012-11-21T16:46:58+09:00</dc:date>
    <utime>1353484018</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/15.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/2.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/3.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/14.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/13.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/12.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/11.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/10.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/9.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/spring_atoz/pages/7.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/15.html">
    <title>トップページ</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/15.html</link>
    <description>
      *はじめに

このサイトは、Spring Frameworkを０からマスターするまで、メモを残しておきます。
あくまで、メモベースなので、これからSpring Frameworkをマスターする人にはお勧め

*環境準備

１．環境変数にHOMEを追加する。具体的には、[コンピュータ]-[プロパティ]-[システムの詳細設定]-[環境変数]で行う。
　　自分のユーザディレクトリでもよい。
２．http://mergedoc.sourceforge.jp/より、「Pleiades All in One 4.2.1 Java Full Edition x64」をダウンロードし、D:\pleiades\にインストール
３．ecpliseを起動し、workspaceをD:\pleiades\workspaceを指定する。
４．[ヘルプ]-[Eclipseマーケットプレイス]-[SpringSource Tool Suite]をインストール

*Spring MVCでHello Worldの作り方

１．[ファイル]-[新規]-[Spring]-[Spring Template Project]-[Spring MVC Project]を選択
２．プロジェクト名を「springmvc_helloworld」、パッケージ名を「jp.sample.spring_mvc.helloworld」
　　※パッケージ名は、会社のドメインを逆転させ、その下に名前を付けるのが一般的
３．パッケージ・エクスプローラーで、右クリックで[実行]-[サーバーで実行]-[Apache Tomcat v7.0]を選択し、
　　Tomcatインストール・ディレクトリを、D:\pleiades\tomcat\7.0に指定し、サーバ実行する。
　　※[ウィンドウ]-[ビューの表示]-[その他]-[サーバー]を選択すると、tomcatを起動、停止ができる。
４．http://localhost:8080/spring_helloworldで実行すると、Hello Worldが表示される。

*Spring BatchでHello Worldの作り方

１．[ファイル]-[新規]-[Spring]-[Spring Template Project]-[Simple Spring Batch Project]を選択
２．プロジェクト名を「springmvc_helloworld」、パッケージ名を「jp.sample.spring_mvc.helloworld」
３．パッケージ・エクスプローラーで、右クリックで[実行]-[Maven clean]、[Maven install]でjarを作成
　　※cleanをしないと、jarが見つからない状態になる。
４．パッケージ・エクスプローラーで、右クリックで[実行]-[実行の構成]を開き、
　　[Javaアプリケーション]-[CodeSwitcher]で、以下の設定を行い、実行を押すとHello Worldが表示される。
　　・メイン・クラス＝org.springframework.batch.core.launch.support.CommandLineJobRunner
　　・プログラムの引数＝classpath:/launch-context.xml job1
５．コマンドラインから実行する場合は、パッケージ・エクスプローラーで、右クリックで[実行]-[実行の構成]を開き、
　　[Maven install]を実行する。その後、pom.xmlを修正し、jar→warに変更して、再度[Maven install]を実行。その後は、以下のコマンドに従う。
 cd D:\pleiades\workspace\springbatch_helloworld\target\classes
 copy ..\spring-batch-simple-2.0.0.CI-SNAPSHOT.jar .
 set set classpath=D:\pleiades\workspace\springbatch_helloworld\target\spring-batch-simple-2.0.0.CI-SNAPSHOT\WEB-INF\lib\*;D:\pleiades\workspace\springbatch_helloworld\target\classes\*
 java org.springframework.batch.core.launch.support.CommandLineJobRunner /launch-context.xml job1
　　※実際の環境に合わせて、classpathおよびlunch-context.xmlのパスを修正する。

*[Spring Batch]log4jの使い方
ログの出力方法をコントロールし、log4j.propertiesを変更することにより、ログの出力方法を変更することができる。
エラーレベルは、DEBUG, INFO, WARN, ERROR, FATALの５つがあり、パッケージレベルで指定可能。
# コンソールへログを出力（デフォルトの指定）
 log4j.rootCategory=ERROR, stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - &lt;%m&gt;%n
# ログファイルへ出力（D:\test.logへ10ＭＢで分割、最大50ファイル）
 log4j.rootCategory=ERROR, fileout
 log4j.appender.fileout=org.apache.log4j.RollingFileAppender
 log4j.appender.fileout.File=D:/test.log
 log4j.appender.fileout.MaxFileSize=10MB
 log4j.appender.fileout.MaxBackupIndex=50
 log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
 log4j.appender.fileout.layout.conversionPattern=%d{yyyy/MM/dd HH:mm:ss.SSS} [%p] - %m%n
# ＤＢへ出力（oracleのLOG_TABLEへ出力）
 log4j.rootCategory=ERROR, dbout
 log4j.category.com.fc2web.himtodo.test=DEBUG, TEST
 log4j.appender.dbout=org.apache.log4j.jdbc.JDBCAppender
 log4j.appender.dbout.URL=jdbc:oracle:thin:@127.0.0.1:1521:TEST
 log4j.appender.dbout.user=test
 log4j.appender.dbout.password=test
 log4j.appender.dbout.driver=oracle.jdbc.driver.OracleDriver
 log4j.appender.dbout.bufferSize=1
 log4j.appender.dbout.layout=org.apache.log4j.PatternLayout
 log4j.appender.dbout.layout.conversionPattern=INSERT INTO LOG_TABLE VALUES (&#039;%d{yyyy-MM-dd HH:mm:ss.SSS}&#039;, &#039;%p&#039;, &#039;%m&#039; )
# 実行した結果のみ出力する。
 log4j.rootCategory=ERROR, stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%m
 log4j.logger.jp=INFO
# 他にも、Unix Syslog デーモン、NT イベントログへ出力が可能。

*[Spring Batch]Mavenでpostgresを追加し、DBとの連携を行う。

SpringBatchでは実行状態を保存するために、DBを使用する。そこで、postgresのJDBCをmavenで追加し、
batch.propertiesを設定する。
　※この設定をすると、毎回パラメータ(date=2012/1/1 name=1など)を変更しないと実行できなくなるので、要注意。
　　強制実行する場合は、引数に-nextを入れる。
１．postgresインストール後、pgAdminから新しいデータベース(springbatch)を作成する。
２．パッケージ・エクスプローラーで、右クリックで[Maven]-[依存関係の追加]を開く。
３．パターン(*)の入力で、「postgres」を入力すると、検索結果に「postgres postgres」が出てくるので、
　　その中から最新版を選択し、[OK]を押すと、postgresのJDBCドライバが追加される。
４．batch.propertiesを以下のように書き換え、バッチプログラムを実行すると、DBにテーブルが作成される。
 batch.jdbc.driver=org.postgresql.Driver
 batch.jdbc.url=jdbc:postgresql://localhost:5432/springbatch
 # use this one for a separate server process so you can inspect the results
 # (or add it to system properties with -D to override at run time).
 # batch.jdbc.url=jdbc:hsqldb:hsql://localhost:9005/samples
 batch.jdbc.user=postgres
 batch.jdbc.password=&lt;postgresで指定したパスワード&gt;
 batch.schema=
 batch.schema.script=classpath:/org/springframework/batch/core/schema-postgresql.sql
５．2回目以降の実行で、テーブル作成は不要であるため、launch-context.xmlの以下の項目をコメントアウトする。
 &lt;!--
 	&lt;jdbc:initialize-database data-source=&quot;dataSource&quot;&gt;
 		&lt;jdbc:script location=&quot;${batch.schema.script}&quot; /&gt;
 	&lt;/jdbc:initialize-database&gt;
 --&gt;    </description>
    <dc:date>2012-11-21T16:46:58+09:00</dc:date>
    <utime>1353484018</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/2.html">
    <title>メニュー</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/2.html</link>
    <description>
      **メニュー
-[[トップページ]]    </description>
    <dc:date>2012-11-20T14:34:19+09:00</dc:date>
    <utime>1353389659</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/3.html">
    <title>右メニュー</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/3.html</link>
    <description>
      **更新履歴
#recent(20)    </description>
    <dc:date>2012-11-20T14:34:06+09:00</dc:date>
    <utime>1353389646</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/14.html">
    <title>プラグイン/インスタグラム</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/14.html</link>
    <description>
      *インスタグラムプラグイン

人気の画像共有サービス、Instagram(インスタグラム）の画像をアットウィキに貼れるプラグインです。


 #ig_user(ユーザー名)
 と記載することで、特定ユーザーのInstagramのフィードを表示することができます。

例）@dogoftheday
#ig_user(dogoftheday)

----

 #ig_tags(タグ名)
 と記載することで、特定タグのInstagramのフィードを表示することができます。

#dogofthedayjp タグ
#ig_tag(dogofthedayjp)

----

 #ig_popular
 と記載することで、Instagramのpopularフィードを表示することができます。



詳しい使い方は以下のページを参考にしてください！
＝＞http://www1.atwiki.jp/guide/pages/935.html

--------    </description>
    <dc:date>2012-11-16T19:05:51+09:00</dc:date>
    <utime>1353060351</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/13.html">
    <title>プラグイン/人気商品一覧</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/13.html</link>
    <description>
      * 人気商品一覧
@wikiのwikiモードでは
 #price_list(カテゴリ名)
と入力することで、あるカテゴリの売れ筋商品のリストを表示することができます。

カテゴリには以下のキーワードがご利用できます。
|キーワード|表示される内容|
|ps3|PlayStation3|
|ps2|PlayStation3|
|psp|PSP|
|wii|Wii|
|xbox|XBOX|
|nds|Nintendo DS|
|desctop-pc|デスクトップパソコン|
|note-pc|ノートパソコン|
|mp3player|デジタルオーディオプレイヤー|
|kaden|家電|
|aircon|エアコン|
|camera|カメラ|
|game-toy|ゲーム・おもちゃ全般|
|all|指定無し|

空白の場合はランダムな商品が表示されます。

※このプラグインは[[価格比較サイト@PRICE&gt;&gt;http://atprice.jp]]のデータを利用しています。

-----

たとえば、
 #price_list(game-toy)
と入力すると以下のように表示されます。

ゲーム・おもちゃ全般の売れ筋商品
#price_list(game-toy)

ノートパソコンの売れ筋商品
#price_list(game-toy)

人気商品リスト
#price_list()
    </description>
    <dc:date>2012-11-16T19:05:51+09:00</dc:date>
    <utime>1353060351</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/12.html">
    <title>プラグイン/コメント</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/12.html</link>
    <description>
      * コメントプラグイン
@wikiのwikiモードでは
 #comment()
と入力することでコメントフォームを簡単に作成することができます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/17_60_ja.html


-----
たとえば、#comment() と入力すると以下のように表示されます。

#comment    </description>
    <dc:date>2012-11-16T19:05:51+09:00</dc:date>
    <utime>1353060351</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/11.html">
    <title>プラグイン/関連ブログ</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/11.html</link>
    <description>
      * 関連ブログ
@wikiのwikiモードでは
 #bf(興味のある単語)
と入力することで、あるキーワードに関連するブログ一覧を表示することができます

詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/17_161_ja.html

-----


たとえば、#bf(ゲーム)と入力すると以下のように表示されます。


#bf(ゲーム)
    </description>
    <dc:date>2012-11-16T19:05:51+09:00</dc:date>
    <utime>1353060351</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/10.html">
    <title>プラグイン</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/10.html</link>
    <description>
      @wikiにはいくつかの便利なプラグインがあります。

-----


#ls

-----

これ以外のプラグインについては@wikiガイドをご覧ください
=&gt;http://atwiki.jp/guide/
    </description>
    <dc:date>2012-11-16T19:05:51+09:00</dc:date>
    <utime>1353060351</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/9.html">
    <title>プラグイン/動画(Youtube)</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/9.html</link>
    <description>
      * 動画(youtube)
@wikiのwikiモードでは
 #video(動画のURL)
と入力することで、動画を貼り付けることが出来ます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/17_209_ja.html

また動画のURLはYoutubeのURLをご利用ください。
＝＞http://www.youtube.com/

-----


たとえば、#video(http://youtube.com/watch?v=kTV1CcS53JQ)と入力すると以下のように表示されます。


#video(http://youtube.com/watch?v=kTV1CcS53JQ)

    </description>
    <dc:date>2012-11-16T19:05:51+09:00</dc:date>
    <utime>1353060351</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/spring_atoz/pages/7.html">
    <title>プラグイン/アーカイブ</title>
    <link>https://w.atwiki.jp/spring_atoz/pages/7.html</link>
    <description>
      * アーカイブ
@wikiのwikiモードでは
 #archive_log()
と入力することで、特定のウェブページを保存しておくことができます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/25_171_ja.html


-----


たとえば、#archive_log()と入力すると以下のように表示されます。
保存したいURLとサイト名を入力して&quot;アーカイブログ&quot;をクリックしてみよう


#archive_log()
    </description>
    <dc:date>2012-11-16T19:05:51+09:00</dc:date>
    <utime>1353060351</utime>
  </item>
  </rdf:RDF>
