2017-03-04 47 views
0

我想執行我的SpringBoot webapp jar引發頁面未找到錯誤。 ,但在Spring-Too-Suite上運行時它會正常工作。春季引導jsp和可執行jar引發/錯誤

我的主類

@SpringBootApplication 
    public class WudiDataApplication { 

     public static void main(String[] args) { 
      SpringApplication.run(WudiDataApplication.class, args); 
     } 
    } 

application.propertie文件像下面

spring.mvc.view.prefix:/WEB-INF/jsp/ 

spring.mvc.view.suffix: .jsp 

server.port=8080 

這是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    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.wudidata</groupId> 
    <artifactId>demo</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 

    <name>newWudiData</name> 
    <description>Demo project for Spring Boot</description> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.4.3.RELEASE</version> 
     <relativePath/> <!-- lookup parent from repository --> 
    </parent> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <java.version>1.8</java.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-jpa</artifactId> 
     </dependency> 

     <dependency> 
    <groupId>org.springframework.data</groupId> 
    <artifactId>spring-data-jpa</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-security</artifactId> 
     </dependency> 
     <dependency> 
    <groupId>org.springframework.security</groupId> 
    <artifactId>spring-security-taglibs</artifactId> 
    </dependency> 

     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-entitymanager</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.postgresql</groupId> 
      <artifactId>postgresql</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.mockito</groupId> 
      <artifactId>mockito-all</artifactId> 
      <version>1.9.5</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-dbcp</groupId> 
      <artifactId>commons-dbcp</artifactId> 
      </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
     </dependency> 
      <dependency> 
      <groupId>org.apache.tomcat.embed</groupId> 
      <artifactId>tomcat-embed-jasper</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
     </dependency> 

    <dependency> 
    <groupId>commons-io</groupId> 
    <artifactId>commons-io</artifactId> 
    <version>1.3.2</version> 
    </dependency> 


     <dependency> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-devtools</artifactId> 
       <optional>true</optional> 
      </dependency> 



    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 


</project> 

....更新....

我已經創建了配置文件下面給出,但仍表現出同樣的錯誤離子類..

@Configuration 
@EnableTransactionManagement 
@EnableWebMvc 
public class DbConfig { 
.......} 

回答

1

實際上我們不能創造罐子在春季啓動JSP。嘗試建立戰爭,它有一些特定的文件夾結構,需要

0

您需要創建一個配置CLASSE,使Web MVC框架

@Configuration 
@EnableWebMvc 
public class WebConfig { 

} 
+0

我已經創建的配置類,如下給出,但仍表現出同樣的錯誤.. (@Configuration @EnableTransactionManagement @EnableWebMvc) 公共類DBCONFIG { } –