anyone can explain to me why my spring jpms module exited ?
my code is too simple :
package ir.moke.module.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = "ir.moke.module.spring.api")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Controller class:
package ir.moke.module.spring.api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/test")
public class TestApi {
@GetMapping("/hello")
public String sayHello() {
return "Hello dear !";
}
}
this is module-info.java
module spring.jpms {
requires spring.web;
requires spring.boot.autoconfigure;
requires spring.boot;
requires spring.core;
opens ir.moke.module.spring to spring.core, spring.beans,spring.context ;
opens ir.moke.module.spring.api to spring.beans, spring.web;
}
pom.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>ir.moke.module</groupId>
<artifactId>spring</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring</name>
<description>Demo project for Spring Boot</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>21</release>
</configuration>
</plugin>
<!-- copy compiled jar file to target/lib , only needed for test jpms -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<outputDirectory>${project.build.directory}/lib/</outputDirectory>
</configuration>
</plugin>
<!-- Copy dependencies , only needed for test jpms -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I compiled project with this command :
mvn -DskipTests clean compile package
and try to run :
> java --module-path target/lib -m spring.jpms/ir.moke.module.spring.Application
. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.3.0)
[2024-06-03 22:19:05.264] - 85702 INFO [main] --- ir.moke.module.spring.Application: Starting Application using Java 21 with PID 85702 (/home/mah454/Downloads/spring/target/lib/spring-0.0.1-SNAPSHOT.jar started by mah454 in /home/mah454/Downloads/spring)
[2024-06-03 22:19:05.293] - 85702 INFO [main] --- ir.moke.module.spring.Application: No active profile set, falling back to 1 default profile: "default"
[2024-06-03 22:19:05.860] - 85702 INFO [main] --- ir.moke.module.spring.Application: Started Application in 0.888 seconds (process running for 1.197)
Spring application just exited without any error or exception !
how to debug this problem ?