如何部署自定义.properties文件到AWS ElasticBeanstalk一个春天启动应用程序?

tambovflow:

我有一个使用不同的环境特性的春季启动应用程序。基于所选择的环境它提取从所需要的数据application-{dev/stag/prod}.properties,是在位于文件./resources一切工作像它应该通过本地运行InteliJ创建的.jar文件(使用摇篮与创建时运行,也时bootJar)。

我创建了一个AWS ElasticBeanstalk应用。在该应用程序我创建了一个Java环境,并部署了.jar文件那里。当部署我看到在日志中以下错误:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.5.RELEASE)

2019-07-12 07:47:26.773  INFO 3315 --- [           main] nl.abc.sgapi.SgApiApplication      : Starting SgApiApplication on ip-172-31-29-160 with PID 3315 (/var/app/current/application.jar started by webapp in /var/app/current)
2019-07-12 07:47:26.795  INFO 3315 --- [           main] nl.abc.sgapi.SgApiApplication      : The following profiles are active: dev
2019-07-12 07:47:31.392  INFO 3315 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-07-12 07:47:31.713  INFO 3315 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 301ms. Found 6 repository interfaces.
2019-07-12 07:47:33.384  INFO 3315 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$59ac5acc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-12 07:47:33.518  INFO 3315 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.throttling-com.weddini.throttling.autoconfigure.ThrottlingProperties' of type [com.weddini.throttling.autoconfigure.ThrottlingProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-12 07:47:33.530  INFO 3315 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'com.weddini.throttling.autoconfigure.ThrottlingAutoConfiguration' of type [com.weddini.throttling.autoconfigure.ThrottlingAutoConfiguration$$EnhancerBySpringCGLIB$$16a02498] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-12 07:47:33.543  INFO 3315 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'throttlingEvaluator' of type [com.weddini.throttling.service.ThrottlingEvaluatorImpl] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-12 07:47:33.569  INFO 3315 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'throttlingService' of type [com.weddini.throttling.service.ThrottlingServiceImpl] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-12 07:47:33.593  INFO 3315 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.hateoas.config.HateoasConfiguration' of type [org.springframework.hateoas.config.HateoasConfiguration$$EnhancerBySpringCGLIB$$d92ca7fe] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-12 07:47:35.100  INFO 3315 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 5000 (http)
2019-07-12 07:47:35.224  INFO 3315 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-07-12 07:47:35.225  INFO 3315 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.19]
2019-07-12 07:47:35.515  INFO 3315 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-07-12 07:47:35.516  INFO 3315 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 8443 ms
2019-07-12 07:47:39.298  INFO 3315 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-07-12 07:47:50.424 ERROR 3315 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

org.postgresql.util.PSQLException: The connection attempt failed.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292) ~[postgresql-42.2.5.jar!/:42.2.5]
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.5.jar!/:42.2.5]
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195) ~[postgresql-42.2.5.jar!/:42.2.5]
    at org.postgresql.Driver.makeConnection(Driver.java:454) ~[postgresql-42.2.5.jar!/:42.2.5]
    at org.postgresql.Driver.connect(Driver.java:256) ~[postgresql-42.2.5.jar!/:42.2.5]
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136) ~[HikariCP-3.2.0.jar!/:na]

看来,如果AWS ElasticBeanstalk不能中读取值application-dev.properties的文件。

下面是我的application-dev.properties文件看起来像:

spring.datasource.hikari.connectionTimeout=20000
spring.datasource.hikari.maximumPoolSize=5
spring.datasource.url=jdbc:postgresql://{REDACTED}
spring.datasource.username={REDACTED}
spring.datasource.password={REDACTED}
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
app.message=Hello from dev properties

我已经试过移动环境的具体性能的主要application.properties文件,并创建一个.jar。但是,这也不能工作。

我可以尝试下呢?

narzero:

它看起来像你的春天启动应用程序无法连接到PostgreSQL数据库。我建议你杜贝尔检查用户名和密码。如果你有防火墙活跃,检查是否有连接到数据库服务器白名单。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何获得春天启动应用程序的jar父文件夹的路径动态?

使用CodePipeline在另一个AWS账户中部署ElasticBeanstalk应用程序

如何启用春天启动应用程序承载认证?

如何使用自定义项目文件夹结构在Beanstalk中部署Go Web应用程序

创建自定义RestTemplate当春天启动会得到一个错误

使用 git 使用自定义名称将应用程序部署到 Heroku?

将React应用程序部署到自定义域名

如何将 Azure AD 中的用户身份验证到部署在 Google 云运行中的自定义 Web 应用程序?

杰克逊被忽略了我的春天启动的应用程序spring.jackson.properties

使用AWS Cognito的Java API认证/ autorization春天启动的Web应用程序

为什么春天启动2.0应用程序不运行schema.sql文件?

如何从自定义分支部署到heroku?

如何在我的Microsoft Teams自定义应用程序中重定向到另一个页面?

如何创建春天启动的自定义注释?

将Azure Web App自定义域克隆到另一个应用程序

无法将自定义工件部署到 elasticbeanstalk 并绕过 git 归档

以编程方式删除从ServerDelegate扩展到的Eclipse自定义IServer上部署的应用程序

如何强制一个春天启动JVM为UTC时区?

如何测试与@PreAuthorized annoted一个春天启动控制器的方法(hasAnyAuthority(...))

如何将自定义 ObservableCollection 元素复制到另一个自定义 ObservableCollection?

如何创建将文本复制到剪贴板的自定义应用程序启动器?

将编写在一个文件中的 Flask 应用程序部署到 Heroku

部署App Engine应用程序时如何设置自定义版本?

如何在Kubernetes上部署自定义Nginx应用程序?

Maven:如何使用部署文件和自定义旅行车进行部署

如何将一个App Engine应用程序部署到多个项目

如何从HomePage(Page)重定向到您的自定义应用程序模型

部署自定义android应用

如何从 .desktop 文件访问自定义 PATH 程序