Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 禁用Spring启动应用程序上的HTTP服务_Java_Spring Boot_Gradle_Intellij Idea - Fatal编程技术网

Java 禁用Spring启动应用程序上的HTTP服务

Java 禁用Spring启动应用程序上的HTTP服务,java,spring-boot,gradle,intellij-idea,Java,Spring Boot,Gradle,Intellij Idea,下面我有一个简单的SpringBootGradle应用程序,它不接受来自web服务器的任何请求。如果我使用简单的gradle命令或从EclipseIDE内部运行此应用程序,它将完成。如果我从Intellij IDEA运行此应用程序,它只会在末尾停止,而不会结束。同时,web服务在端口8080上启动,该端口显示白标签错误页面 为什么要启动web服务?我可以禁用它吗?我可以更改HTTP端口吗?为什么它不是从Eclipse开始的 @SpringBootApplication public class

下面我有一个简单的SpringBootGradle应用程序,它不接受来自web服务器的任何请求。如果我使用简单的gradle命令或从EclipseIDE内部运行此应用程序,它将完成。如果我从Intellij IDEA运行此应用程序,它只会在末尾停止,而不会结束。同时,web服务在端口8080上启动,该端口显示
白标签错误页面

为什么要启动web服务?我可以禁用它吗?我可以更改HTTP端口吗?为什么它不是从Eclipse开始的

@SpringBootApplication
public class runMe {
    
    public static void main(String[] args)
    {
        
        System.out.println("starting");
        SpringApplication.run(runMe.class, args);
        System.out.println("ending");

    }
    
    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
        return args -> 
        {

            System.out.println("Let's inspect the beans provided by Spring Boot:");

            String[] beanNames = ctx.getBeanDefinitionNames();
            Arrays.sort(beanNames);
            for (String beanName : beanNames) {
                System.out.println("Name "+beanName);
            }

        };
    }

}
UPD

build.gradle文件:

plugins {
    id 'org.springframework.boot' version '2.3.4.RELEASE'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

您在项目依赖项中是否有类似的
spring boot starter web
spring boot starter tomcat
?请发布build.gradle文件。是的,我在依赖项中有
spring boot starter web
。UPD中
build.gradle
的全部内容在问题正文中。