I want to use the command "mvn spring-boot:run" but I want to use it with some arguments or something that allows me to use only DemoApplication.java and runs the project without any errors. Warnings are NOT a problem.
I cannot delete the other @SpringBootApplication Annotated file named SecureAppApplication nor change its content. (Courtesy of a strict Professor with unreasonable demands)
Here is the relevant error message after executing command: mvn spring-boot:run
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-
maven-plugin:2.1.8.RELEASE:run (default-cli) on project myproject:
Execution default-cli of goal org.springframework.boot:spring-boot-
maven-plugin:2.1.8.RELEASE:run failed: Unable to find a single main
class from the following candidates
[com.example1.example1.DemoApplication,
com.example1.example1.secureapp.SecureAppApplication]
Here is the DemoApplication file code:
package com.example1.example1;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
System.out.println("System is working!");
}
}
Here is the SecureAppApplication.java file code:
package com.example1.example1.secureapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@SpringBootApplication
public class SecureAppApplication {
public static void main(String[] args) {
SpringApplication.run(SecureAppApplication.class, args);
}
}