gpt4 book ai didi

spring-boot - Spring Boot排除了在Maven构建期间连接到数据库的问题

转载 作者:行者123 更新时间:2023-12-01 23:12:11 25 4
gpt4 key购买 nike

我有一种情况,我想在AWS中部署Spring Boot应用程序,但我只想忽略本地构建期间内部发生的数据库连接,因为我没有任何测试类,也不想包含H2数据库。可以建立要在AWS中部署的jar文件而无需连接到AWS数据库吗?

Application.properties

# ===============================
# = DATA SOURCE
# ===============================

# Set here configurations for the database connection

# Connection url for the database "netgloo_blog"

spring.datasource.url = jdbc:mysql://localhost:3306/auto_journey

# Username and password
spring.datasource.username = root
spring.datasource.password =auto123

# Keep the connection alive if idle for a long time (needed in production)
#spring.datasource.testWhileIdle = true
#spring.datasource.validationQuery = SELECT 1

# ===============================
# = JPA / HIBERNATE
# ===============================

# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager).

# Show or not log for each sql query
spring.jpa.show-sql = true

# Hibernate ddl auto (create, create-drop, update): with "update" the database
# schema will be automatically updated accordingly to java entities found in
# the project
spring.jpa.hibernate.ddl-auto = update

# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

server.servlet.context-path=/autofinance


server.port=9090


spring.mvc.static-path-pattern=/resources/**

最佳答案

将其包含在pom.xml中以解决该问题。

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>

关于spring-boot - Spring Boot排除了在Maven构建期间连接到数据库的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53929866/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com