2016-03-26 16 views
-1

Ich schreibe ein einfaches Springboot mehrere Module. ein Elternmodul hat zwei Untermodulzugriffs- und Webmodul. Ich lege alle Modulkonfiguration unten. Dieses Beispielprojekt richtig funktioniert, wenn es sich ein Modul, aber wenn ich es in mehreren ModulenSpring Boot Maven mehrere Modul

diese Ausnahme werfen

Update: volle Stack-Trace

Exception in thread "main" java.lang.IllegalArgumentException : Invalid argument Syntax: - = bei org.springframework.core.env.SimpleCommandLineArgsParser.parse (SimpleCommandLineArgsParser.java:75) bei org.springframework.core.env.SimpleCommandLinePropertySource (SimpleCommandLinePropertySource.java:87) bei org. .springframework.boot.SpringApplication.configurePropertySources (SpringApplication.java:44 3) bei org.springframework.boot.SpringApplication.configureEnvironment (SpringApplication.java:414) bei org.springframework.boot.SpringApplication.run (SpringApplication.java:284) bei org.springframework.boot.SpringApplication.run (SpringApplication.java:961) bei org.springframework.boot.SpringApplication.run (SpringApplication.java:950) bei com.spring.controller.Application.main (Application.java:21)

werde ich Geben Sie weitere Informationen über die Probe, wenn sie benötigt werden.

Mutter Modul:

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.2.7.RELEASE</version> 
</parent> 
<modelVersion>4.0.0</modelVersion> 
<name>parent</name> 
<groupId>com.spring</groupId> 
<artifactId>parent</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<packaging>pom</packaging> 
<properties> 
    <maven.compiler.source>1.8</maven.compiler.source> 
    <maven.compiler.target>1.8</maven.compiler.target> 
    <spring-boot.version>1.3.3.RELEASE</spring-boot.version> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
</properties> 

<modules> 
    <module>access</module> 
    <module>web</module> 
</modules> 

und Zugriffsmodul Config ist diese

<parent> 
    <artifactId>parent</artifactId> 
    <groupId>com.spring</groupId> 
    <version>0.0.1-SNAPSHOT</version> 
</parent> 
<modelVersion>4.0.0</modelVersion> 

<artifactId>access</artifactId> 
<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-thymeleaf</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-jpa</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-rest-core</artifactId> 
     <version>2.2.1.RELEASE</version> 
    </dependency> 
</dependencies> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <configuration> 
       <executable>true</executable> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <configuration> 
       <useSystemClassLoader>false</useSystemClassLoader> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

und Web-Modul Konfiguration ist folgendes:

<parent> 
    <artifactId>parent</artifactId> 
    <groupId>com.spring</groupId> 
    <version>0.0.1-SNAPSHOT</version> 
</parent> 
<modelVersion>4.0.0</modelVersion> 

<artifactId>web</artifactId> 
<dependencies> 
    <dependency> 
     <groupId>com.spring</groupId> 
     <artifactId>access</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-thymeleaf</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-jpa</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-rest</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
    </dependency> 
</dependencies> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <start-class>com.spring.controller.Application</start-class> 
    <java.version>1.8</java.version> 
</properties> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <configuration> 
       <executable>true</executable> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <configuration> 
       <useSystemClassLoader>false</useSystemClassLoader> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

und Anwendungsklasse-Code ist :

@Configuration 
@ComponentScan("com.spring.controller") 
@EnableJpaRepositories 
@Import(RepositoryRestMvcConfiguration.class) 
@EnableAutoConfiguration 
@PropertySource("application.properties") 
public class Application { 

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

Was ist die vollständige Stack-Trace? –

+0

@Andy Wilkinson, ich legte volle Stack-Spur. – ali

Antwort

2

Die Ausnahme besagt, dass Sie die Methode SpringApplication.run(...) nicht verwenden. Es sieht so aus als würdest du übergeben - = als Argumente.

Schauen Sie sich den Spring Boot Guide an oder geben Sie uns Ihr Code-Snippet.

https://spring.io/guides/gs/spring-boot/

Edit 1:

Das Problem kommt von den Argumenten des Laufs Konfiguration.

Die in den Argumenten gefundenen Parameter sind nicht korrekt. --= ist nicht akzeptabel.

+0

Danke für Ihre Antwort. Bitte schau auf meine aktualisierte Frage. Ich füge Anwendungsklasse hinzu. – ali

+1

Das Problem kommt von den Argumenten Ihrer Laufkonfiguration. Die in den Argumenten gefundenen Parameter sind falsch. –

Verwandte Themen