Spring

To register additional bean definitions when processing @Configuration classes

Implement interface ImportBeanDefinitionRegistrar and then @Import it at the @Configuration class

JPA repository

@EnableJpaRepositories(basePackageClasses = {PreparedJobRepository.class},
        // The default lookup strategy is CREATE_IF_NOT_FOUND which cause
        //   IJ031070: Transaction cannot proceed: STATUS_MARKED_ROLLBACK
        // when boostraping spring in side EJB container, the following may happen:
        //   - When Spring initializes JPA repositories, for each query method on the interface, 
        //      it calls the Entity Manager to look for a named query. Normally, no such query will be found.
        //      Ref: org.springframework.data.jpa.repository.query.NamedQuery.hasNamedQuery()
        //   - The entity manager, when it doesn't found a named query, for JTA case, will lookup the transaction, 
        //      sets rollback-only, and throw IllegalArgumentRuntimeException.
        //      This is correct according to the JPA specs.
        //      Ref: org.hibernate.jpa.spi.AbstractEntityManagerImpl.buildQueryFromName
        //   - Spring closes the entity manager and lookup the next one (for each lookup, 
        //      it creates a new entity manager). No error raised. This is what Spring expects
        //   - After spring finishes starting. The next EBJ service runs, it touches the data source which is 
        //      backed by a rollback-only transaction. Then this error is raised
        //
        // Using "CREATE" strategy will avoid having to lookup existing queries.
        queryLookupStrategy = QueryLookupStrategy.Key.CREATE)

Query spring cloud config server

Using Intellij HTTP request

GET http://config-server:8888/<application>/<profile>
Authorization:Basic ....
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3

Typical settings for Tomcat JDBC connection pool

# Number of connections that are created when the pool is started
#
# Default: 10
spring.datasource.tomcat.initialSize=

# The maximum number of active connections that can be allocated from this pool at the same time
# This attribute is used to limit the number of connections a pool can have open so that 
# capacity planning can be done on the database side: max connection in DB configuration = maxActive + maxIdle
#
# Default: 100
spring.datasource.tomcat.maxActive=

# The maximum number of idle connections that should be kept in the pool at all times
# Idle connections are checked periodically and connections that have been idle for longer than 
# minEvictableIdleTimeMillis will be released
#
# Default: 100 (equal maxActive)
spring.datasource.tomcat.maxIdle=

# The minimum number of established connections that should be kept in the pool at all times.
# The connection pool can shrink below this number if validation queries fail
#
# Default: 10 (equal initialSize)
spring.datasource.tomcat.minIdle=

# The number of milliseconds to sleep between runs of the idle connection validation/cleaner thread.
# This value should not be set under 1 second. It dictates how often we check for idle, abandoned connections, 
# and how often we validate idle connections.
#
# Default: 5000
spring.datasource.tomcat.timeBetweenEvictionRunsMillis=

# The minimum amount of time an connection may sit idle in the pool before it is eligible for eviction.
#
# Default: 60000
spring.datasource.tomcat.minEvictableIdleTimeMillis=

# The connection will be validated before being borrowed from the pool.
# If the connection fails to validate, it will be dropped from the pool, and we will attempt to borrow another.
# NOTE the validationQuery is configured in the code under classes IngresDialectSpecific and OracleDialectSpecific
#
# Default: false
# Recommend: true to avoid "SQLNonTransientConnectionException: Connection closed" in some DBs
spring.datasource.tomcat.testOnBorrow=true

# How often the validation query will be run, only run validation at most at this frequency – time in milliseconds.
# If a connection is due for validation, but has been validated previously within this interval, 
# it will not be validated again. The larger the value, the better the performance, 
# but you increase the chance of a stale connection being presented to your application.
#
# Default: 3000
spring.datasource.tomcat.validationInterval=