Pracuji s intellij, jsem nastavit proměnné prostředí v Maven konfigurace (vpravo nahoře, přidat konfiguraci, běžec, proměnné prostředí)
Je to jako to čte název proměnné jako Řetězec namísto proměnné pomoc prosím
vlastnosti aplikace:
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
proměnné prostředí(v maven konfigurace):
SERVICE_PASSWORD=;MYSQL_HOST=localhost:3306/orderup;SERVICE_USER=root
zpráva:
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>