栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Spring Boot + GWT嵌入式配置

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Spring Boot + GWT嵌入式配置

经过长时间的搜索和测试,这是我想出的解决方案:

    <!-- POM -->    <modelVersion>4.0.0</modelVersion>    <groupId>fr.ekito.gwt</groupId>    <artifactId>gwt-boot</artifactId>    <version>0.0.1-SNAPSHOT</version>    <packaging>jar</packaging>    <name>Ekito Spring Boot GWT WebApp</name>    <parent>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-parent</artifactId>        <version>1.2.5.RELEASE</version>    </parent>    <properties>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>        <start-class>fr.ekito.gwt.server.ServerApplication</start-class>        <java.version>1.7</java.version>        <gwtVersion>2.6.0</gwtVersion>        <googleGin>2.1.2</googleGin>        <outputFolder>${project.build.directory}/${artifactId}</outputFolder>    </properties>    <dependencies>        <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions>     <exclusion>         <groupId>org.springframework.boot</groupId>         <artifactId>spring-boot-starter-tomcat</artifactId>     </exclusion> </exclusions>        </dependency>        <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-undertow</artifactId> <exclusions>     <exclusion>         <groupId>io.undertow</groupId>         <artifactId>undertow-websockets-jsr</artifactId>     </exclusion> </exclusions>        </dependency>        <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId>        </dependency>        <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <version>${gwtVersion}</version>        </dependency>        <dependency> <groupId>com.google.gwt.inject</groupId> <artifactId>gin</artifactId> <version>${googleGin}</version>        </dependency>    </dependencies>    <build>        <plugins> <plugin>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-maven-plugin</artifactId>     <configuration>         <mainClass>${start-class}</mainClass>         <layout>ZIP</layout>     </configuration> </plugin> <plugin>     <groupId>org.prehaus.mojo</groupId>     <artifactId>gwt-maven-plugin</artifactId>     <version>${gwtVersion}</version>     <executions>         <execution>  <goals>      <goal>compile</goal>  </goals>         </execution>     </executions>     <configuration>         <runTarget>GwtWebApp.html</runTarget>         <persistentunitcachedir>${project.build.directory}</persistentunitcachedir>         <deploy>${project.build.directory}/gwt-deploy</deploy>         <webappDirectory>${project.build.directory}/classes/public</webappDirectory>     </configuration> </plugin>        </plugins>    </build>

我的项目结构与原始项目https://github.com/Ekito/spring-boot-
gwt
相同,不同之处在于:

  • 而不是 webapp 文件夹,我有 src / main / resources / public 文件夹,并且有html&css文件。
  • 不需要web.xml文件,spring-boot会照顾它。
  • 不需要WEB-INF文件夹。

结果,我有一个可运行的jar,但是由org.springframework.boot.loader.PropertiesLauncher运行。单个jar可以按预期工作,Tomcat不能按以下说明工作:http : //docs.spring.io/spring-
boot/docs/current/reference/html/boot-features-developing-web-
applications.html#boot-features -jsp-
limitations。

另外,我可以将lib文件夹移到jar文件之外,但是为了设置

loader.path
属性,我需要将其放在jar文件中的application.properties中。我应该可以使用-
Dloader.path但没有用。

我会咨询spring队的。但是到目前为止,它是有希望的。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/412116.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号