Ola fiz a configuração aqui pelo Eclipse:
-DRESTAURANTES_JWT_SECRET=123456
-DRESTAURANTES_DATABASE_URL=jdbc:mysql://localhost:3306/restaurantes?useTimezone=true&serverTimezone=UTC
-DRESTAURANTES_DATABASE_USERNAME=root
-DRESTAURANTES_DATABASE_PASSWORD=root
Esta dando este erro: Começou a dar erro no teste, mas antes de criar as variáveis de ambiente estava passando certinho:
[INFO] Total time: 11.374 s
[INFO] Finished at: 2022-06-21T15:08:11-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project restaurantes: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Workspace\ProjetoRestaurantes\FontesRestaurantes\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Eu não criei a properties Prod, deixei como default, e muda para Application-teste.properties somente na área de teste, usando a anotação para forçar o test.
# datasource url: jdbc:mysql://localhost:3306/restaurantes?useTimezone=true&serverTimezone=UTC
spring.datasource.url=${RESTAURANTES_DATABASE_URL}
spring.datasource.username=${RESTAURANTES_DATABASE_USERNAME}
spring.datasource.password=${RESTAURANTES_DATABASE_PASSWORD}
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImproveNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
# jwt A+X;fTJP&Pd,TD9dwVq(hsHX,ya^<wsD_UK7L+@=S;{'CydP]{v@}G'b>et;yz$*\yL5S8EJN:%P:X%H9>#nYLrX}@\s?CQcpspH,2emzBc!Q[V'AYa~uzF8WR~AUrMzxp/V$9([S9X#zj/CH('#]B_Hc+%fGhe27YB;^j4\Xk=Ju"Ap~_&<L;=!Z;!,2UP;!hF3P]j85#*`&T]/kB/W^6$v~u6qpejL>kY^f)sy4:qTq_Ec!-z!@aAp~sLKGU>$
forum.jwt.secret=${RESTAURANTES_JWT_SECRET}
forum.jwt.expiration=86400000
# actuator
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
info.app.name=@project.name@
info.app.version=@project.version@
# spring boot admin server
spring.boot.admin.client.url=http://localhost:8081