- pom.xml:コンテンツ
<?xml version = "1.0"エンコード= "UTF-8"?> <プロジェクトのxmlns = "http://maven.apache.org/POM/4.0.0"のxmlnsを:XSI = "のhttp://www.w3 .ORG / 2001 / XMLスキーマ・インスタンス」 のxsi:のschemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion> 4.0.0 </ modelVersion> <groupIdを> com.zrm </ groupIdを> <たartifactId>春</たartifactId> <バージョン> 1.0-SNAPSHOT </バージョン> <名前>春</名前> <! - FIXMEプロジェクトのウェブサイトにそれを変更する- > <URL>のhttp:// www.example.com </ URL> <プロパティ>maven.compiler.source> 1.7 </maven.compiler.source> <maven.compiler.target> 1.7 </maven.compiler.target> <project.build.sourceEncoding> UTF-8 </project.build.sourceEncoding> <maven.compiler.source> 1.7 </maven.compiler.source> </プロパティ> <依存性> <依存性> <のgroupId>コモンズ-DBCP </のgroupId> <たartifactId>コモンズ-DBCP </たartifactId> <バージョン> 1.2 0.1 </バージョン> <除外> <除外> <たartifactId> xercesImpl </たartifactId> <のgroupId> Xercesの</ groupIdを> </除外> </除外> </依存> <依存性> <のgroupId> JUnitの</のgroupId > <たartifactId> JUnitの</たartifactId> <バージョン> 4.11 </バージョン> <スコープ>テスト</スコープ> </依存> <依存性> <のgroupId> org.springframework </のgroupId> <たartifactId>ばねコア</たartifactId> <バージョン> 5.1.7.RELEASE </バージョン> </依存> <依存> <のgroupId> org.springframework </のgroupId> <たartifactId>ばねコンテキスト</たartifactId> <バージョン> 5.1.7.RELEASE </バージョン> </依存> <依存性> <のgroupId> org.springframework </のgroupId> <たartifactId>春豆</たartifactId> <バージョン> 5.1.7.RELEASE </バージョン> </依存関係> <依存> <groupIdを> org.springframework </ groupIdを> <たartifactId>ばね発現</たartifactId> <バージョン> 5.1.7.RELEASE </バージョン> </依存> <依存性> <のgroupId> org.apache.commons </のgroupId> <たartifactId>コモンズ-lang3 </たartifactId > <バージョン> 3.9 </ version>の </依存関係> <依存> <groupIdを>コモンズ-ログイン</ groupIdを> <たartifactId>コモンズ-ログイン</たartifactId> <バージョン> 1.2 </ version>の </依存関係> <依存関係> 依存関係> <groupIdを> ch.qos.logback </ groupIdを> <たartifactId> logback-古典</たartifactId> <バージョン> 1.2.3 </バージョン> </依存関係> </依存関係> <構築> <pluginManagement> < - (かもしれMavenのデフォルトを使用しないようにプラグインのバージョンをロックダウン! )親POMに移動- > <プラグイン> < -クリーンライフサイクルは、HTTPSを参照してください!// maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle - > <プラグイン> <たartifactId >のmaven-クリーン・プラグイン</たartifactId> <バージョン> 3.1.0 </バージョン> </プラグイン> <! - デフォルトのライフサイクル、瓶包装:見ます。https:// maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging - > <プラグイン> <プラグイン> <たartifactId>のmaven-リソース・プラグイン</たartifactId> <バージョン> 3.0.2 </バージョン> </プラグイン> <プラグイン> <たartifactId>のmaven-コンパイラプラグイン</たartifactId> <バージョン> 3.8.0 </バージョン> </プラグイン> <プラグイン> <たartifactId>達人-確実な-プラグイン</たartifactId> <バージョン> 2.22.1 </バージョン> </プラグイン> <たartifactId>達人-ジャーのプラグイン</たartifactId> <バージョン> 3.0.2 </バージョン> </プラグイン> <プラグイン> <たartifactId> Mavenのインストール・プラグイン</たartifactId> <バージョン> 2.5.2 </バージョン> </プラグイン> <プラグイン> <たartifactId> Mavenのデプロイ・プラグイン</たartifactId> <バージョン> 2.8.2 </バージョン> </プラグイン> <! -サイトのライフサイクルは、HTTPSを参照してください:// maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle - > <プラグイン> <たartifactId>のmaven-サイト-プラグイン</たartifactId> <プラグイン> <たartifactId>のmaven-プロジェクト情報 - レポート - プラグイン</たartifactId>maven-サイトのプラグイン</たartifactId> <バージョン> 3.7.1 </バージョン> </プラグイン> <バージョン> 3.0.0 </バージョン> </プラグイン> </プラグイン> </ pluginManagement> </構築> </プロジェクト>
- シンプルな豆
パッケージcom.zrm。 パブリック クラス人{ プライベート整数歳。 プライベート文字列名; 公共の整数getAge(){ 戻り値の年齢。 } 公共 ボイドsetAge(整数年齢){ この .age = 年齢。 } パブリック文字列のgetName(){ 戻り名。 } 公共 ボイドのsetName(文字列名){ この .nameの= 名前。 } } パッケージcom.zrm。 インポートorg.apache.commons.lang3.builder.ToStringBuilder; 輸入org.apache.commons.lang3.builder.ToStringStyle。 輸入org.springframework.context.support.ClassPathXmlApplicationContext; パブリック クラスのApp { 公共の 静的な 無効メイン(文字列[] args)を{ // 测试 ClassPathXmlApplicationContext CTX = 新 ClassPathXmlApplicationContext( "a.xml" ); 人の人物 = ctx.getBean( "人"、人。クラス); System.out.println(ToStringBuilder.reflectionToString(人、ToStringStyle.MULTI_LINE_STYLE)); } }
- 春のアプリケーション構成ファイル、単純な名前のa.xmlを構築するために、この時間
<?xml version = "1.0"エンコード= "UTF-8"?> <豆のxmlns = "http://www.springframework.org/schema/beans" のxmlns:XSI = "http://www.w3.org / 2001 / XMLスキーマ・インスタンス" のxmlns:P = "http://www.springframework.org/schema/p" のxmlns:MVC = "http://www.springframework.org/schema/mvc" のxmlns:コンテキスト =" 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/mvc のhttp:// WWW。springframework.org/schema/mvc/spring-mvc.xsd http:// www.springframework.org/schema/context ます。http:// www.springframework.org/schema/context/spring-context.xsd "> <豆ID ="人」クラス = "com.zrm.Person" > <プロパティ名= "名前"値= "ZRM"> </ property>の <プロパティ名= "年齢"> <値> 18 </ value>の </ property>の </豆> </豆>
建物環境のプロセスでファイルのエンコーディングの問題は、アプリケーションファイルで見られたに矛盾リードである:序文許さ異常内容、およびファイルが設定ファイルを読み込んで見つけることができない、ファイルが問題は存在しません。