Java springbootmaven多模块
我编写了一个简单的spring引导多模块。父模块有两个子模块access和web模块。我把所有模块配置放在下面。当这个示例项目是一个模块时,它可以正常工作,但是当我把它放在多个模块中时,就会抛出这个异常 更新:完整堆栈跟踪 线程主java.lang.IllegalArgumentException中出现异常:参数语法无效:-= 位于org.springframework.core.env.SimpleCommandLineArgsParser.parseSimpleCommandLineArgsParser.java:75 位于org.springframework.core.env.SimpleCommandLinePropertySource.SimpleCommandLinePropertySource.java:87 位于org.springframework.boot.SpringApplication.configurePropertySourcesSpringApplication.java:443 位于org.springframework.boot.SpringApplication.configureEnvironmentSpringApplication.java:414 位于org.springframework.boot.SpringApplication.runSpringApplication.java:284 位于org.springframework.boot.SpringApplication.runSpringApplication.java:961 位于org.springframework.boot.SpringApplication.runSpringApplication.java:950 位于com.spring.controller.Application.mainApplication.java:21 如果需要,我会提供更多关于样品的信息 父模块:Java springbootmaven多模块,java,spring,maven,spring-boot,Java,Spring,Maven,Spring Boot,我编写了一个简单的spring引导多模块。父模块有两个子模块access和web模块。我把所有模块配置放在下面。当这个示例项目是一个模块时,它可以正常工作,但是当我把它放在多个模块中时,就会抛出这个异常 更新:完整堆栈跟踪 线程主java.lang.IllegalArgumentException中出现异常:参数语法无效:-= 位于org.springframework.core.env.SimpleCommandLineArgsParser.parseSimpleCommandLineArgs
异常状态表明您无法使用SpringApplication.run。。。方法看起来您正在传递-=作为参数 查看Spring引导指南了解其用法,或者给我们您的代码片段 编辑1:
问题来自运行配置的参数
在args中找到的参数不正确。-=不可接受。什么是完整堆栈跟踪?@Andy Wilkinson,我放了完整堆栈跟踪。谢谢你的回答。请看我最新的问题。我添加了应用程序类。问题来自运行配置的参数。在args中找到的参数不正确。
<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>
<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>
<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>
@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);
}
}