왜 환경 변수에서 작동하지 않 봄(maven)?

0

질문

나는 작업 intellij,내가 설정된 환경 변수에 Maven 구성(오른쪽 상단에,추가 구성,러너,환경 변수)

그것은 그것과 같은 변수를 읽고 이름으로 대신 문자열 변수 도시

응용 프로그램 속성:

server.port=8081
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST}?zeroDateTimeBehavior=convertToNull
spring.datasource.username=${SERVICE_USER}
spring.datasource.password=${SERVICE_PASSWORD}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
#spring.jpa.show-sql: true

환경변수(에 maven 구성):

SERVICE_PASSWORD=;MYSQL_HOST=localhost:3306/orderup;SERVICE_USER=root

메시지:

No such host is known (${MYSQL_HOST})

pom.xml:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
        
hibernate intellij-idea maven spring
2021-11-18 20:51:06
1

최고의 응답

0

만약 당신이 시도하고 있는 속성을 사용하여서 pom.xmlapplication.properties 이것을 보십시오:

spring.datasource.url=jdbc:mysql://@MYSQL_HOST@?zeroDateTimeBehavior=convertToNull
2021-11-18 21:57:09

아니,내가 하려고 속성을 사용하여서 메이븐 구성에서 intellij 오른쪽 상단 모서리에,편집,구성,러너,환경변수
Xavier Luzuriaga

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................