在 Jhipster 中添加新的个人资料

问题描述 投票:0回答:1

我有一个由 Jhipster 生成的 Spring Boot 项目,我想向该项目添加暂存配置文件,我还将其添加到 pom 文件中。

<profile>
            <id>staging</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-devtools</artifactId>
                    <optional>true</optional>
                </dependency>
                <dependency>
                    <groupId>com.oracle.database.jdbc</groupId>
                    <artifactId>ojdbc8</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.testcontainers</groupId>
                    <artifactId>oracle-xe</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>

                </plugins>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-failsafe-plugin</artifactId>
                            <version>${maven-failsafe-plugin.version}</version>
                            <configuration>
                                <!-- Due to spring-boot repackage, without adding this property test classes are not found
                                     See https://github.com/spring-projects/spring-boot/issues/6254 -->
                                <classesDirectory>${project.build.outputDirectory}
                                </classesDirectory>
                                <!-- Force alphabetical order to have a reproducible build -->
                                <runOrder>alphabetical</runOrder>
                                <includes>
                                    <include>**/*IT*</include>
                                    <include>**/*IntTest*</include>
                                </includes>
                                <argLine>@{argLine} -Dspring.profiles.active=teststaging</argLine>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>integration-test</id>
                                    <goals>
                                        <goal>integration-test</goal>
                                    </goals>
                                </execution>
                                <execution>
                                    <id>verify</id>
                                    <goals>
                                        <goal>verify</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.liquibase</groupId>
                            <artifactId>liquibase-maven-plugin</artifactId>
                            <version>${liquibase.version}</version>
                            <configuration>
                                <changeLogFile>
                                    ${project.basedir}/src/main/resources/config/liquibase/master.xml
                                </changeLogFile>
                                <diffChangeLogFile>
                                    ${project.basedir}/src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml
                                </diffChangeLogFile>
                                <driver>oracle.jdbc.OracleDriver</driver>
                                <url>jdbc:oracle:thin:@localhost:1521:xe</url>
                                <defaultSchemaName></defaultSchemaName>
                                <username></username>
                                <password></password>
                                <referenceUrl>
                                    hibernate:spring:com.app.authen.domain?dialect=org.hibernate.dialect.Oracle12cDialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
                                </referenceUrl>
                                <verbose>true</verbose>
                                <logging>debug</logging>
                                <contexts>!test</contexts>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <groupId>org.liquibase</groupId>
                                    <artifactId>liquibase-core</artifactId>
                                    <version>${liquibase.version}</version>
                                </dependency>
                                <dependency>
                                    <groupId>org.liquibase.ext</groupId>
                                    <artifactId>liquibase-hibernate5</artifactId>
                                    <version>${liquibase-hibernate5.version}</version>
                                </dependency>
                                <dependency>
                                    <groupId>org.springframework.boot</groupId>
                                    <artifactId>spring-boot-starter-data-jpa</artifactId>
                                    <version>${spring-boot.version}</version>
                                </dependency>
                                <dependency>
                                    <groupId>javax.validation</groupId>
                                    <artifactId>validation-api</artifactId>
                                    <version>${validation-api.version}</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
            <properties>
                <!-- default Spring profiles -->
                <spring.profiles.active>staging${profile.tls}${profile.no-liquibase}
                </spring.profiles.active>
            </properties>
        </profile>

当我运行该项目时,它就停在这里:

2023-09-26T17:44:04.126+07:00 DEBUG 26784 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl        : Trying to establish a protocol version 3 connection to 10.22.110.215:5432 
2023-09-26T17:44:04.173+07:00 DEBUG 26784 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl        : Receive Buffer Size is 65,536 
2023-09-26T17:44:04.173+07:00 DEBUG 26784 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl        : Send Buffer Size is 65,536 
2023-09-26T17:44:04.380+07:00 DEBUG 26784 --- [onnection adder] org.postgresql.jdbc.PgConnection         :   setAutoCommit = false 
2023-09-26T17:44:04.381+07:00 DEBUG 26784 --- [onnection adder] org.postgresql.Driver                    : Connecting with URL: jdbc:postgresql://10.22.110.215:5432/apps 
2023-09-26T17:44:04.381+07:00 DEBUG 26784 --- [onnection adder] org.postgresql.jdbc.PgConnection         : PostgreSQL JDBC Driver 42.3.6 
2023-09-26T17:44:04.381+07:00 DEBUG 26784 --- [onnection adder] org.postgresql.jdbc.PgConnection         :   setDefaultFetchSize = 0 
2023-09-26T17:44:04.381+07:00 DEBUG 26784 --- [onnection adder] org.postgresql.jdbc.PgConnection         :   setPrepareThreshold = 5 
2023-09-26T17:44:04.381+07:00 DEBUG 26784 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl        : Trying to establish a protocol version 3 connection to 10.22.110.215:5432 
2023-09-26T17:44:04.408+07:00 DEBUG 26784 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl        : Receive Buffer Size is 65,536 
2023-09-26T17:44:04.409+07:00 DEBUG 26784 --- [onnection adder] o.p.core.v3.ConnectionFactoryImpl        : Send Buffer Size is 65,536 
2023-09-26T17:44:04.600+07:00 DEBUG 26784 --- [onnection adder] org.postgresql.jdbc.PgConnection         :   setAutoCommit = false 

我的项目无法启动。这个问题我已经处理了3天了,还是没能解决。我想知道如何处理这个问题。非常感谢。

spring-boot jhipster profile
1个回答
0
投票

您需要 2 个配置文件,第一个是 Maven 配置文件,第二个是 Spring Boot 配置文件。

在 pom 中有将其传递给的连接 到 springboot。

记住为新配置文件创建 yaml 文件。

© www.soinside.com 2019 - 2024. All rights reserved.