java - 图标有问题

标签 java android android-studio

我使用 Mike Penz 的 MaterialDrawer 实现了一个 NavigationDrawer。 它工作正常,但是当我尝试替换“GoogleMaterial”上的图标“FontAwesome”或其他图标时,出现错误“不幸的是,应用程序已停止。” 全部仅适用于图标“FontAwesome” 如何解决这个问题呢? 预先感谢您!

MainActivity.java:

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;

import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.typeface.FontAwesome;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;

public class MainActivity extends ActionBarActivity {

    private Drawer.Result drawerResult = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Handle Toolbar
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        toolbar.getBackground().setAlpha(100);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        drawerResult = new Drawer()
                .withActivity(this)
                .withToolbar(toolbar)
                .withActionBarDrawerToggle(true)
                .withHeader(R.layout.drawer_header)
                .addDrawerItems(
                        new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_database).withIcon(FontAwesome.Icon.faw_database),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_map).withIcon(FontAwesome.Icon.faw_map_marker),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_guides).withIcon(FontAwesome.Icon.faw_book),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_crafting).withIcon(GoogleMaterial.Icon.gmd_build),
                        //new PrimaryDrawerItem().withName(R.string.drawer_item_tools).withIcon(GoogleMaterial.Icon.gmd_build),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_links).withIcon(FontAwesome.Icon.faw_link),
                        new DividerDrawerItem(),
                        //new PrimaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(GoogleMaterial.Icon.gmd_settings),
                        new PrimaryDrawerItem().withName(R.string.drawer_item_feedback).withIcon(FontAwesome.Icon.faw_envelope)
                        //new PrimaryDrawerItem().withName(R.string.drawer_item_changes).withIcon(Typeicons.Icon.typ_clipboard)
                )
                .build();
    }

    @Override
    public void onBackPressed() {
        if (drawerResult.isDrawerOpen()) {
            drawerResult.closeDrawer();
        } else {
            super.onBackPressed();
        }
    }
}

activity_main.xml:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/blackToolbar"
            android:elevation="4dp"
            android:minHeight="?attr/actionBarSize"
            android:paddingTop="@dimen/tool_bar_top_padding"
            android:transitionName="actionBar" />

</RelativeLayout>

构建.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "org.enotboris.app"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile('com.mikepenz.materialdrawer:library:0.9.5@aar') {
        transitive = true
    }
    compile 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar'
    compile 'com.mikepenz:devicon-typeface:2.0.0.2@aar'
    compile 'com.mikepenz:material-design-iconic-typeface:2.2.0.2@aar'
    compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
    compile 'com.mikepenz:octicons-typeface:3.2.0.2@aar'
    compile 'com.mikepenz:meteocons-typeface:1.1.0.2@aar'
    compile 'com.mikepenz:community-material-typeface:1.7.22.1@aar'
    compile 'com.mikepenz:weather-icons-typeface:2.0.10.2@aar'
    compile 'com.mikepenz:typeicons-typeface:2.0.7.2@aar'
    compile 'com.mikepenz:entypo-typeface:1.0.0.2@aar'
    compile 'com.mikepenz:devicon-typeface:2.0.0.2@aar'
    compile 'com.mikepenz:foundation-icons-typeface:3.0.0.2@aar'
    compile 'com.mikepenz:ionicons-typeface:2.0.1.2@aar'
    testCompile 'junit:junit:4.12'
}

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.enotboris.dayz">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

日志猫:

01-25 15:29:09.739 2594-2594/? D/dalvikvm: Not late-enabling CheckJNI (already on)
01-25 15:29:09.739 2594-2594/? E/Trace: error opening trace file: Permission denied (13)
01-25 15:29:09.749 2594-2594/? I/dalvikvm: Could not find method android.app.Application.registerOnProvideAssistDataListener, referenced from method com.android.tools.fd.runtime.BootstrapApplication.registerOnProvideAssistDataListener
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 231: Landroid/app/Application;.registerOnProvideAssistDataListener (Landroid/app/Application$OnProvideAssistDataListener;)V
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-25 15:29:09.749 2594-2594/? I/dalvikvm: Could not find method android.app.Application.unregisterOnProvideAssistDataListener, referenced from method com.android.tools.fd.runtime.BootstrapApplication.unregisterOnProvideAssistDataListener
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 234: Landroid/app/Application;.unregisterOnProvideAssistDataListener (Landroid/app/Application$OnProvideAssistDataListener;)V
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-25 15:29:09.749 2594-2594/? I/InstantRun: Instant Run Runtime started. Android package is org.enotboris.dayz, real application class is null.
01-25 15:29:09.749 2594-2594/? W/InstantRun: No instant run dex files added to classpath

                                             [ 01-25 15:29:09.749  1418: 1526 D/         ]
                                             HostConnection::get() New Host Connection established 0xb8b397b0, tid 1526
01-25 15:29:09.749 2594-2594/? E/dalvikvm: Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.monkeyPatchExistingResources
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve check-cast 1926 (Landroid/util/ArrayMap;) in Lcom/android/tools/fd/runtime/MonkeyPatcher;
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x1f at 0x025e
01-25 15:29:09.749 2594-2594/? E/dalvikvm: Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.pruneResourceCache
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve const-class 1926 (Landroid/util/ArrayMap;) in Lcom/android/tools/fd/runtime/MonkeyPatcher;
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x1c at 0x0060
01-25 15:29:09.749 2594-2594/? I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve interface method 16445: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
01-25 15:29:09.749 2594-2594/? I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve interface method 16447: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-25 15:29:09.749 2594-2594/? I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve interface method 16451: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-25 15:29:09.749 2594-2594/? I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 673: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-25 15:29:09.749 2594-2594/? I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
01-25 15:29:09.749 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 695: Landroid/content/res/TypedArray;.getType (I)I
01-25 15:29:09.749 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
01-25 15:29:09.759 2594-2594/? I/dalvikvm: Could not find method android.support.graphics.drawable.VectorDrawableCompat.getLayoutDirection, referenced from method android.support.graphics.drawable.VectorDrawableCompat.needMirroring
01-25 15:29:09.759 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 1746: Landroid/support/graphics/drawable/VectorDrawableCompat;.getLayoutDirection ()I
01-25 15:29:09.759 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x000f
01-25 15:29:09.759 2594-2594/? I/dalvikvm: Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
01-25 15:29:09.759 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 16344: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
01-25 15:29:09.759 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6f at 0x0007
01-25 15:29:09.759 2594-2594/? I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
01-25 15:29:09.759 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 417: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
01-25 15:29:09.759 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
01-25 15:29:09.769 2594-2594/? I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
01-25 15:29:09.769 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 636: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
01-25 15:29:09.769 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-25 15:29:09.769 2594-2594/? I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
01-25 15:29:09.769 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 638: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
01-25 15:29:09.769 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-25 15:29:09.779 2594-2598/? D/dalvikvm: GC_CONCURRENT freed 261K, 4% free 10877K/11271K, paused 0ms+12ms, total 15ms
01-25 15:29:09.779 2594-2594/? E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
01-25 15:29:09.779 2594-2594/? W/dalvikvm: VFY: unable to resolve instanceof 153 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
01-25 15:29:09.779 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
01-25 15:29:09.779 2594-2594/? I/dalvikvm: Could not find method android.support.v4.widget.DrawerLayout$LayoutParams.setMarginEnd, referenced from method com.mikepenz.materialdrawer.Drawer.processDrawerLayoutParams
01-25 15:29:09.779 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 10374: Landroid/support/v4/widget/DrawerLayout$LayoutParams;.setMarginEnd (I)V
01-25 15:29:09.779 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0021
01-25 15:29:09.789 2594-2594/? I/dalvikvm: Could not find method android.support.v4.widget.DrawerLayout$LayoutParams.setMarginEnd, referenced from method com.mikepenz.materialdrawer.Drawer.processDrawerLayoutParams
01-25 15:29:09.789 2594-2594/? W/dalvikvm: VFY: unable to resolve virtual method 10374: Landroid/support/v4/widget/DrawerLayout$LayoutParams;.setMarginEnd (I)V
01-25 15:29:09.789 2594-2594/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0042
01-25 15:29:09.789 2594-2594/? D/dalvikvm: GC_FOR_ALLOC freed 25K, 4% free 10907K/11271K, paused 2ms, total 2ms
01-25 15:29:09.789 2594-2594/? I/dalvikvm-heap: Grow heap (frag case) to 11.286MB for 589836-byte allocation
01-25 15:29:09.799 2594-2598/? D/dalvikvm: GC_CONCURRENT freed 2K, 4% free 11480K/11911K, paused 11ms+0ms, total 12ms
01-25 15:29:09.809 2594-2594/? D/dalvikvm: GC_FOR_ALLOC freed <1K, 4% free 11480K/11911K, paused 3ms, total 3ms
01-25 15:29:09.809 2594-2594/? I/dalvikvm-heap: Grow heap (frag case) to 13.534MB for 2359308-byte allocation
01-25 15:29:09.819 2594-2598/? D/dalvikvm: GC_CONCURRENT freed 0K, 4% free 13784K/14279K, paused 11ms+0ms, total 12ms
01-25 15:29:09.869 2594-2594/? D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
01-25 15:29:09.869 2594-2594/? D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
01-25 15:29:09.869 2594-2594/? D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so

                                         [ 01-25 15:29:09.869  2594: 2594 D/         ]
                                         HostConnection::get() New Host Connection established 0xb893e0e8, tid 2594
01-25 15:29:09.879 2594-2594/? W/gralloc_ranchu: Gralloc pipe failed
01-25 15:29:09.889 2594-2594/? D/OpenGLRenderer: Enabling debug mode 0
01-25 15:29:09.889 2594-2594/? D/AndroidRuntime: Shutting down VM
01-25 15:29:09.889 2594-2594/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa6623228)
01-25 15:29:09.899 2594-2594/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 java.lang.RuntimeException: The font for the given icon isn't registered!
                                                     at com.mikepenz.iconics.IconicsDrawable.icon(IconicsDrawable.java:121)
                                                     at com.mikepenz.iconics.IconicsDrawable.<init>(IconicsDrawable.java:89)
                                                     at com.mikepenz.materialdrawer.model.PrimaryDrawerItem.convertView(PrimaryDrawerItem.java:190)
                                                     at com.mikepenz.materialdrawer.adapter.DrawerAdapter.getView(DrawerAdapter.java:125)
                                                     at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
                                                     at android.widget.AbsListView.obtainView(AbsListView.java:2271)
                                                     at android.widget.ListView.makeAndAddView(ListView.java:1769)
                                                     at android.widget.ListView.fillDown(ListView.java:672)
                                                     at android.widget.ListView.fillSpecific(ListView.java:1330)
                                                     at android.widget.ListView.layoutChildren(ListView.java:1612)
                                                     at android.widget.AbsListView.onLayout(AbsListView.java:2106)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
                                                     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
                                                     at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1217)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
                                                     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
                                                     at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
                                                     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
                                                     at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                                                     at android.view.View.layout(View.java:13754)
                                                     at android.view.ViewGroup.layout(ViewGroup.java:4364)
                                                     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1868)
                                                     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1689)
                                                     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
                                                     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4214)
                                                     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
                                                     at android.view.Choreographer.doCallbacks(Choreographer.java:555)
                                                     at android.view.Choreographer.doFrame(Choreographer.java:525)
                                                     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
                                                     at android.os.Handler.handleCallback(Handler.java:615)
                                                     at android.os.Handler.dispatchMessage(Handler.java:92)
                                                     at android.os.Looper.loop(Looper.java:137)
                                                     at android.app.ActivityThread.main(ActivityThread.java:4745)
                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                     at java.lang.reflect.Method.invoke(Method.java:511)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                     at dalvik.system.NativeStart.main(Native Method)

示例:

With "FontAwesome" icons

With "GoogleMaterialDesign" and other icons

最佳答案

解决方案:

Iconics.init(getApplicationContext());
Iconics.registerFont(new GoogleMaterial());

感谢您的宝贵时间!

关于java - 图标有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41855503/

相关文章:

android - sqlite3 rawquery 更新不起作用

如果用户在显示通知时尝试授予权限,则 Android "Screen Overlay Detected"消息

android - 如何解决Android Studio中的以下gradle依赖项不匹配问题?问题在下面提到:

java - 在作业调度程序中使用 wait() 时获取 IllegalMonitorStateException

java - 使用 Jsoup 登录网站时遇到问题,

java - Spring Data,JPQL,按日期列的年和月分组

android - 改变 Material 图标的颜色?

android - Gradle sync更新到2.0.0-rc2版本后找不到add-on

java - 如何使用 Swagger Core (springdoc-openapi) 生成 OpenAPI 任意类型?

java - 将 Spring Socials (Facebook) 与基于 XML 的 Spring MVC 集成