Gok*_*ner 11 gwt embeddedwebserver spring-boot
我想配置Spring Boot Embedded Servlet Container + GWT.我想要的方法是创建一个jar/war文件,它只包含已编译的gwt文件和静态资源.我想从lib/*加载jar和从classpath加载配置文件.
我找不到任何有效的例子.实际上有一个,https://github.com/Ekito/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.codehaus.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>
Run Code Online (Sandbox Code Playgroud)
```
我的项目结构与原始项目https://github.com/Ekito/spring-boot-gwt相同,不同之处在于:
结果,我有一个可运行的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但没有用。
我会咨询春季队的。但是到目前为止,它是有希望的。
| 归档时间: |
|
| 查看次数: |
4989 次 |
| 最近记录: |