2013-10-15 3 views
3

Я пытаюсь реализовать Apache Tiles 3 в моем приложении Spring MVC, поэтому я добавил следующую зависимость к файлу pom.xml:Реализовать плитки 3 с приложением Spring MVC

<dependency> 
     <groupId>org.apache.tiles</groupId> 
     <artifactId>tiles-extras</artifactId> 
     <version>3.0.0</version> 
    </dependency>  

, насколько я на веб-сайте Tiles это должно быть достаточно, чтобы добавить все, включая поддержку JSP (пожалуйста, поправьте меня, если я ошибаюсь).

Теперь моя проблема в том, что я не понимаю, как (где) добавить следующую информацию о бобах? Должен ли он быть добавлен в servlet-context.xml? Я буду ценить его так много, если кто-то может вести меня, пожалуйста, о том, где эта информация должна быть добавлена ​​

<bean class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"> 
<property name="viewClass" 
    value="org.springframework.web.servlet.view.tiles3.TilesView"></property> 
<property name="order" value="0"></property> 
</bean> 
<bean class="org.springframework.web.servlet.view.tiles3.TilesConfigurer" 
id="tilesConfigurer"> 
<property name="definitions" value="/WEB-INF/tiles.xml"></property> 
</bean> 

Обратите внимание мое приложение с использованием Spring MVC, Maven и спящий режим.

Спасибо за ваше время

содержание pom.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.mydomainname</groupId> 
    <artifactId>crm</artifactId> 
    <version>1.0.0-BUILD-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name>Inventory</name> 
    <properties> 
    <org.aspectj-version>1.6.9</org.aspectj-version> 
    <java-version>1.6</java-version> 
    <org.springframework-version>3.1.0.RELEASE</org.springframework-version> 
    <org.slf4j-version>1.5.10</org.slf4j-version> 
    </properties> 
    <dependencies> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context</artifactId> 
     <version>3.1.0.RELEASE</version> 
     <scope>compile</scope> 
     <exclusions> 
     <exclusion> 
      <artifactId>commons-logging</artifactId> 
      <groupId>commons-logging</groupId> 
     </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-webmvc</artifactId> 
     <version>3.1.0.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.aspectj</groupId> 
     <artifactId>aspectjrt</artifactId> 
     <version>1.6.9</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
     <version>1.5.10</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>jcl-over-slf4j</artifactId> 
     <version>1.5.10</version> 
     <scope>runtime</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-log4j12</artifactId> 
     <version>1.5.10</version> 
     <scope>runtime</scope> 
    </dependency> 
    <dependency> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>1.2.15</version> 
     <scope>runtime</scope> 
     <exclusions> 
     <exclusion> 
      <artifactId>mail</artifactId> 
      <groupId>javax.mail</groupId> 
     </exclusion> 
     <exclusion> 
      <artifactId>jms</artifactId> 
      <groupId>javax.jms</groupId> 
     </exclusion> 
     <exclusion> 
      <artifactId>jmxtools</artifactId> 
      <groupId>com.sun.jdmk</groupId> 
     </exclusion> 
     <exclusion> 
      <artifactId>jmxri</artifactId> 
      <groupId>com.sun.jmx</groupId> 
     </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>javax.inject</groupId> 
     <artifactId>javax.inject</artifactId> 
     <version>1</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.5</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet.jsp</groupId> 
     <artifactId>jsp-api</artifactId> 
     <version>2.1</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.2</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.7</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-core</artifactId> 
     <version>3.1.3.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-web</artifactId> 
     <version>3.1.3.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-config</artifactId> 
     <version>3.1.3.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-taglibs</artifactId> 
     <version>3.1.3.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
     <version>5.1.6</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-entitymanager</artifactId> 
     <version>3.6.0.Final</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-orm</artifactId> 
     <version>3.1.0.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>commons-dbcp</groupId> 
     <artifactId>commons-dbcp</artifactId> 
     <version>1.2.2</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-resources-plugin</artifactId> 
     <version>2.4.3</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>net.sf.jasperreports</groupId> 
     <artifactId>jasperreports</artifactId> 
     <version>5.2.0</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>commons-collections</groupId> 
     <artifactId>commons-collections</artifactId> 
     <version>3.1</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.codehaus.jackson</groupId> 
     <artifactId>jackson-mapper-asl</artifactId> 
     <version>1.8.5</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.codehaus.jackson</groupId> 
     <artifactId>jackson-core-asl</artifactId> 
     <version>1.8.5</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>commons-io</groupId> 
     <artifactId>commons-io</artifactId> 
     <version>2.4</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>commons-fileupload</groupId> 
     <artifactId>commons-fileupload</artifactId> 
     <version>1.2.2</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.tiles</groupId> 
     <artifactId>tiles-extras</artifactId> 
     <version>3.0.0</version> 
     <scope>compile</scope> 
    </dependency> 
    </dependencies> 
    <repositories> 
    <repository> 
     <snapshots> 
     <enabled>false</enabled> 
     </snapshots> 
     <id>central</id> 
     <name>Maven Repository Switchboard</name> 
     <url>http://repo1.maven.org/maven2</url> 
    </repository> 
    </repositories> 
    <pluginRepositories> 
    <pluginRepository> 
     <releases> 
     <updatePolicy>never</updatePolicy> 
     </releases> 
     <snapshots> 
     <enabled>false</enabled> 
     </snapshots> 
     <id>central</id> 
     <name>Maven Plugin Repository</name> 
     <url>http://repo1.maven.org/maven2</url> 
    </pluginRepository> 
    </pluginRepositories> 
    <build> 
    <sourceDirectory>E:\springsource\workspace\Inventory\src\main\java</sourceDirectory> 
    <scriptSourceDirectory>E:\springsource\workspace\Inventory\src\main\scripts</scriptSourceDirectory> 
    <testSourceDirectory>E:\springsource\workspace\Inventory\src\test\java</testSourceDirectory> 
    <outputDirectory>E:\springsource\workspace\Inventory\target\classes</outputDirectory> 
    <testOutputDirectory>E:\springsource\workspace\Inventory\target\test-classes</testOutputDirectory> 
    <resources> 
     <resource> 
     <directory>E:\springsource\workspace\Inventory\src\main\resources</directory> 
     </resource> 
    </resources> 
    <testResources> 
     <testResource> 
     <directory>E:\springsource\workspace\Inventory\src\test\resources</directory> 
     </testResource> 
    </testResources> 
    <directory>E:\springsource\workspace\Inventory\target</directory> 
    <finalName>crm-1.0.0-BUILD-SNAPSHOT</finalName> 
    <pluginManagement> 
     <plugins> 
     <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.3</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <version>2.2-beta-5</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <version>2.1</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-release-plugin</artifactId> 
      <version>2.0</version> 
     </plugin> 
     </plugins> 
    </pluginManagement> 
    <plugins> 
     <plugin> 
     <artifactId>maven-eclipse-plugin</artifactId> 
     <version>2.9</version> 
     <configuration> 
      <additionalProjectnatures> 
      <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature> 
      </additionalProjectnatures> 
      <additionalBuildcommands> 
      <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand> 
      </additionalBuildcommands> 
      <downloadSources>true</downloadSources> 
      <downloadJavadocs>true</downloadJavadocs> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>2.3.2</version> 
     <executions> 
      <execution> 
      <id>default-testCompile</id> 
      <phase>test-compile</phase> 
      <goals> 
       <goal>testCompile</goal> 
      </goals> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
       <compilerArgument>-Xlint:all</compilerArgument> 
       <showWarnings>true</showWarnings> 
       <showDeprecation>true</showDeprecation> 
      </configuration> 
      </execution> 
      <execution> 
      <id>default-compile</id> 
      <phase>compile</phase> 
      <goals> 
       <goal>compile</goal> 
      </goals> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
       <compilerArgument>-Xlint:all</compilerArgument> 
       <showWarnings>true</showWarnings> 
       <showDeprecation>true</showDeprecation> 
      </configuration> 
      </execution> 
     </executions> 
     <configuration> 
      <source>1.6</source> 
      <target>1.6</target> 
      <compilerArgument>-Xlint:all</compilerArgument> 
      <showWarnings>true</showWarnings> 
      <showDeprecation>true</showDeprecation> 
     </configuration> 
     </plugin> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.2.1</version> 
     <configuration> 
      <mainClass>org.test.int1.Main</mainClass> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-clean-plugin</artifactId> 
     <version>2.4.1</version> 
     <executions> 
      <execution> 
      <id>default-clean</id> 
      <phase>clean</phase> 
      <goals> 
       <goal>clean</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-install-plugin</artifactId> 
     <version>2.3.1</version> 
     <executions> 
      <execution> 
      <id>default-install</id> 
      <phase>install</phase> 
      <goals> 
       <goal>install</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-resources-plugin</artifactId> 
     <version>2.4.3</version> 
     <executions> 
      <execution> 
      <id>default-resources</id> 
      <phase>process-resources</phase> 
      <goals> 
       <goal>resources</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-testResources</id> 
      <phase>process-test-resources</phase> 
      <goals> 
       <goal>testResources</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.7.1</version> 
     <executions> 
      <execution> 
      <id>default-test</id> 
      <phase>test</phase> 
      <goals> 
       <goal>test</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-war-plugin</artifactId> 
     <version>2.1.1</version> 
     <executions> 
      <execution> 
      <id>default-war</id> 
      <phase>package</phase> 
      <goals> 
       <goal>war</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-deploy-plugin</artifactId> 
     <version>2.5</version> 
     <executions> 
      <execution> 
      <id>default-deploy</id> 
      <phase>deploy</phase> 
      <goals> 
       <goal>deploy</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-site-plugin</artifactId> 
     <version>2.0.1</version> 
     <executions> 
      <execution> 
      <id>default-site</id> 
      <phase>site</phase> 
      <goals> 
       <goal>site</goal> 
      </goals> 
      <configuration> 
       <outputDirectory>E:\springsource\workspace\Inventory\target\site</outputDirectory> 
       <reportPlugins> 
       <reportPlugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-project-info-reports-plugin</artifactId> 
       </reportPlugin> 
       </reportPlugins> 
      </configuration> 
      </execution> 
      <execution> 
      <id>default-deploy</id> 
      <phase>site-deploy</phase> 
      <goals> 
       <goal>deploy</goal> 
      </goals> 
      <configuration> 
       <outputDirectory>E:\springsource\workspace\Inventory\target\site</outputDirectory> 
       <reportPlugins> 
       <reportPlugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-project-info-reports-plugin</artifactId> 
       </reportPlugin> 
       </reportPlugins> 
      </configuration> 
      </execution> 
     </executions> 
     <configuration> 
      <outputDirectory>E:\springsource\workspace\Inventory\target\site</outputDirectory> 
      <reportPlugins> 
      <reportPlugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-project-info-reports-plugin</artifactId> 
      </reportPlugin> 
      </reportPlugins> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <reporting> 
    <outputDirectory>E:\springsource\workspace\Inventory\target\site</outputDirectory> 
    </reporting> 
</project> 

Вот полный стек ошибок показано:

ERROR: org.springframework.web.context.ContextLoader - Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userService' is defined 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353) 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:153) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) 
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114) 
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 
    at java.lang.Thread.run(Thread.java:662) 

и, наконец, вот ошибки я получаю:

Build path is incomplete. Cannot find class file for 
org.springframework.web.servlet.view.InternalResourceViewResolver 

Multiple annotations found at this line: 
    - Class 'org.springframework.web.servlet.view.tiles3.TilesViewResolver' not found 
    - Class 'org.springframework.web.servlet.view.tiles3.TilesViewResolver' not found [config set: 
    Inventory/web-context] 

Multiple annotations found at this line: 
    - Class 'org.springframework.web.servlet.view.tiles3.TilesConfigurer' not found 
    - Class 'org.springframework.web.servlet.view.tiles3.TilesConfigurer' not found [config set: 
    Inventory/web-context] 

содержание корневых context.xml:

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

    <!-- Root Context: defines shared resources visible to all other web components --> 
    <import resource="security-context.xml"/> 

    <tx:annotation-driven transaction-manager="transactionManager" /> 

    <context:component-scan base-package="com.mydomainname.crm" /> 

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> 
     <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
     <property name="url" value="jdbc:mysql://localhost:3306/inventory" /> 
     <property name="username" value="root" /> 
     <property name="password" value="123456789" /> 
    </bean> 

    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 
     <property name="maxUploadSize"><value>100000</value> </property>  
    </bean> 
</beans> 

ответ

5

Плитка 3 не работает с пружиной, по крайней мере, до версии 3.1.0. Плитка версии 2.2 работает плавно с Spring до версии 3.1.0.

Все, что мне нужно было сделать, это добавить информацию о bean-файле в servlet-context.xml, добавить зависимость, построить template.xml, шаблоны и все. Все просто работает гладко.

+1

Это правильно. Весна-3.2 поставляется с поддержкой плитки-3. Хотя эта поддержка совместима с весной-3.0 и весной-3.1 просто загрузите и добавьте в свой путь к классу http://wever.org/spring-webmvc-tiles3-3.2.0.RC2-finn-1.jar – mck

+0

Hava Посмотрите этот пост. У меня есть пошаговый список, как создать пример с Spring 3.2 и Tiles 3. http://stackoverflow.com/questions/20924653/how-to-remove-a-tile-in-apache-tiles-for-a -специфичный просмотр – Chrispie

+2

Вы даже можете интегрировать Tile3 с Spring 4.1.5, посмотрите на это https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/htmlsingle/#view-tiles – Jack

1

ViewResolver является тип компонента, используемый DispatcherServlet.

Добавьте свои TilesViewResolver и связанные с ними компоненты в конфигурацию контекста сервлета.

+0

Я попытался добавить TilesViewResolver и TilesConfigurer beans к servlet-context.xml, но я всегда получаю сообщение об ошибке: Несколько аннотаций, найденных в этой строке: - Class 'org.springframework.web.servlet.view.tiles3.TilesViewResolver' не найден - класс 'org.springframework.web.servlet.view.tiles3.TilesViewResolver' not found [config set: Inven/web-context]. Я попробовал обновить, очистить, но ничего не работает :(Любые мысли, как я могу это решить? – MChan

+0

@MChan У вас есть библиотеки плиток на пути к классу? –

+0

Я добавил зависимость Tiles в pom.xml и все баночки Tiles загружены и в place – MChan

Смежные вопросы