第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

由于缺少 ServletWebServerFactory,無法啟動 Web 服務(wù)器

由于缺少 ServletWebServerFactory,無法啟動 Web 服務(wù)器

猛跑小豬 2023-04-13 16:49:30
幾天前我看過 Stack Overflow。我的問題似乎很常見,但我無法解決。我試過這些方法1和2。這是我的 application.propreties :spring.datasource.driver-class-name= org.postgresql.Driverspring.datasource.url=jdbc:postgresql://localhost:5433/mydatabasespring.datasource.username=usernamespring.datasource.password=passwordspring.jpa.hibernate.ddl-auto=createspring.main.web-application-type=none當(dāng)我嘗試運行它時,它給了我以下錯誤:org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean這些是我的主要課程:@SpringBootApplicationpublic class StartApplication {    @Autowired    BookRepository repository;    public static void main(String[] args) {        SpringApplication.run(Application.class, args);    }}這是我的 pom.xml:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0"         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>toto</groupId>    <artifactId>toto</artifactId>    <version>1.0-SNAPSHOT</version>    <parent>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-parent</artifactId>        <version>2.1.2.RELEASE</version>    </parent>    <properties>        <java.version>1.8</java.version>        <downloadSources>true</downloadSources>        <downloadJavadocs>true</downloadJavadocs>    </properties>    <dependencies>        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-data-jpa</artifactId>        </dependency>        <dependency>            <groupId>org.postgresql</groupId>            <artifactId>postgresql</artifactId>        </dependency>在此先感謝您的幫助。
查看完整描述

3 回答

?
牛魔王的故事

TA貢獻1830條經(jīng)驗 獲得超3個贊

你的主類應(yīng)該是這樣的:


@SpringBootApplication

public class StartApplication {

    

    @Autowired

    BookRepository repository;

    

    public static void main(String[] args) {

        SpringApplication.run(StartApplication.class, args);

    }

}


查看完整回答
反對 回復(fù) 2023-04-13
?
呼如林

TA貢獻1798條經(jīng)驗 獲得超3個贊

您應(yīng)該從 application.properties 文件中刪除以下屬性

spring.main.web-application-type=none

這意味著您的應(yīng)用程序中不需要 Web 服務(wù)器。


查看完整回答
反對 回復(fù) 2023-04-13
?
慕碼人8056858

TA貢獻1803條經(jīng)驗 獲得超6個贊

我不是專業(yè)程序員,但如果我是你我會怎么做:

  1. 確保你有一個合適的項目結(jié)構(gòu)

  2. 查看Spring.io的基本配置指南!

祝好運并玩得開心點 :)


查看完整回答
反對 回復(fù) 2023-04-13
  • 3 回答
  • 0 關(guān)注
  • 403 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號