0

I have a spring boot project generated by Jhipster, I want to add a staging profile to the project, I also add this to pom file.

<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>

When I run the project, it just stops at this:

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 

My project cannot start. I have dealt with this problem for 3 days and could not resolve it. I want to know how to deal with this problem. Thank you so much.

1 Answer 1

1

you need 2 profiles one is maven profile the second is spring boot profile.

in the pom have the connection for passing it to to springboot.

Remember to create the yaml file for the new profile to.

2
  • Thank you, I already created application-staging.yml, but my project cannot start, how can I add profile for maven and spring boot and make the connection that you mentioned in the pom file?
    – pxq
    Sep 26 at 11:04
  • On you file "application-staging.yaml" have you defined it ? spring: profiles: active: staging Sep 26 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.