kandi background
Explore Kits

spring-cloud-cloudfoundry | Integration between Cloudfoundry and the Spring | Microservice library

 by   spring-cloud Java Version: Current License: Apache-2.0

 by   spring-cloud Java Version: Current License: Apache-2.0

Download this library from

kandi X-RAY | spring-cloud-cloudfoundry Summary

spring-cloud-cloudfoundry is a Java library typically used in Architecture, Microservice, Spring Boot, Spring, Cloud-foundry applications. spring-cloud-cloudfoundry has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. However spring-cloud-cloudfoundry has 4 bugs. You can download it from GitHub, Maven.
Spring Cloud for Cloudfoundry makes it easy to run Spring Cloud apps in Cloud Foundry (the Platform as a Service). Cloud Foundry has the notion of a "service", which is middlware that you "bind" to an app, essentially providing it with an environment variable containing credentials (e.g. the location and username to use for the service). The spring-cloud-cloudfoundry-commons module configures the Reactor-based Cloud Foundry Java client, v 3.0, and can be used standalone. The spring-cloud-cloudfoundry-web project provides basic support for some enhanced features of webapps in Cloud Foundry: binding automatically to single-sign-on services and optionally enabling sticky routing for discovery. The spring-cloud-cloudfoundry-discovery project provides an implementation of Spring Cloud Commons DiscoveryClient so you can @EnableDiscoveryClient and provide your credentials as spring.cloud.cloudfoundry.discovery.[username,password] (also *.url if you are not connecting to Pivotal Web Services) and then you can use the DiscoveryClient directly or via a LoadBalancerClient.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • spring-cloud-cloudfoundry has a low active ecosystem.
  • It has 83 star(s) with 65 fork(s). There are 36 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 2 open issues and 20 have been closed. On average issues are closed in 71 days. There are 6 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of spring-cloud-cloudfoundry is current.
This Library - Support
Best in #Microservice
Average in #Microservice
This Library - Support
Best in #Microservice
Average in #Microservice

quality kandi Quality

  • spring-cloud-cloudfoundry has 4 bugs (0 blocker, 0 critical, 0 major, 4 minor) and 37 code smells.
This Library - Quality
Best in #Microservice
Average in #Microservice
This Library - Quality
Best in #Microservice
Average in #Microservice

securitySecurity

  • spring-cloud-cloudfoundry has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • spring-cloud-cloudfoundry code analysis shows 0 unresolved vulnerabilities.
  • There are 2 security hotspots that need review.
This Library - Security
Best in #Microservice
Average in #Microservice
This Library - Security
Best in #Microservice
Average in #Microservice

license License

  • spring-cloud-cloudfoundry is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
This Library - License
Best in #Microservice
Average in #Microservice
This Library - License
Best in #Microservice
Average in #Microservice

buildReuse

  • spring-cloud-cloudfoundry releases are not available. You will need to build from source code and install.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • It has 2180 lines of code, 145 functions and 39 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
This Library - Reuse
Best in #Microservice
Average in #Microservice
This Library - Reuse
Best in #Microservice
Average in #Microservice
Top functions reviewed by kandi - BETA

kandi has reviewed spring-cloud-cloudfoundry and discovered the below as its top functions. This is intended to give you an instant insight into spring-cloud-cloudfoundry implemented functionality, and help decide if they suit your requirements.

  • Start the downloader .
  • Post - process vcap resources .
  • Get the instances for a given service .
  • Check if properties are present .
  • Map application instance to serviceInstance .
  • Starts sticky filter .
  • Returns a string representation of this configuration .
  • Returns a function that returns the list of InetAddresses .
  • Bean for Cloud Foundry operations .
  • Gets all the application instances .

spring-cloud-cloudfoundry Key Features

Integration between Cloudfoundry and the Spring Cloud APIs

Basic Compile and Test

copy iconCopydownload iconDownload
$ ./mvnw install

Working with the code

copy iconCopydownload iconDownload
$ ./mvnw eclipse:eclipse

Checkstyle

copy iconCopydownload iconDownload
(3)

IDE setup

copy iconCopydownload iconDownload
(3)

Spring Boot 2 is ignoring HikariCP properties set in application.yml

copy iconCopydownload iconDownload
compile group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector', version: '2.0.7.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector', version: '2.0.7.RELEASE'
-----------------------
implementation 'io.pivotal.cfenv:java-cfenv-boot:2.3.0'
@Configuration
public class CloudConfig {

  @Primary
  @Bean(name = "myDataSource")
  @ConfigurationProperties("spring.datasource.hikari") // added this
  public DataSource becscmDataSource() {
    CfJdbcEnv cfJdbcEnv = new CfJdbcEnv();
    CfJdbcService myJdbc = cfJdbcEnv.findJdbcServiceByName("my-maria-rds");

    DataSourceBuilder builder = DataSourceBuilder.create();
    builder.url(myJdbc.getJdbcUrl());
    builder.username(myJdbc.getUsername());
    builder.password(myJdbc.getPassword());
    builder.driverClassName("org.mariadb.jdbc.Driver");
    return builder.build();
  }
}
-----------------------
implementation 'io.pivotal.cfenv:java-cfenv-boot:2.3.0'
@Configuration
public class CloudConfig {

  @Primary
  @Bean(name = "myDataSource")
  @ConfigurationProperties("spring.datasource.hikari") // added this
  public DataSource becscmDataSource() {
    CfJdbcEnv cfJdbcEnv = new CfJdbcEnv();
    CfJdbcService myJdbc = cfJdbcEnv.findJdbcServiceByName("my-maria-rds");

    DataSourceBuilder builder = DataSourceBuilder.create();
    builder.url(myJdbc.getJdbcUrl());
    builder.username(myJdbc.getUsername());
    builder.password(myJdbc.getPassword());
    builder.driverClassName("org.mariadb.jdbc.Driver");
    return builder.build();
  }
}

Community Discussions

Trending Discussions on spring-cloud-cloudfoundry
  • Spring Boot 2 is ignoring HikariCP properties set in application.yml
Trending Discussions on spring-cloud-cloudfoundry

QUESTION

Spring Boot 2 is ignoring HikariCP properties set in application.yml

Asked 2021-Jun-14 at 20:14

I have a spring boot 2 app which connects to Mariadb database. This app runs in cloud foundry. It takes database connection properties from VCAP_* env variable.

App works fine and can connect to database. But, I have found out that app is not using hikari configuration specified in application.yml.

Can you please suggest what is wrong here?

build.gradle

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'

    compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.6.2'

    compile group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector', version: '2.0.7.RELEASE'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector', version: '2.0.7.RELEASE'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'com.h2database:h2:1.4.200'
}

application.yml

   datasource:
    hikari:
      pool-name: mypool
      auto-commit: true
      connection-timeout: 5000
      minimum-idle: 8
      maximum-pool-size: 8
      idle-timeout: 600000
      max-lifetime: 3600000

CloudConfig.java

@Configuration
public class CloudConfig {

  @Bean
  public CloudFactory cloudFactory() {
    return new CloudFactory();
  }

  private DataSource createDataSource(CloudFactory cloudFactory, String serviceId) {
    return cloudFactory.getCloud().getServiceConnector(serviceId, DataSource.class, null);
  }

  @Primary
  @Bean(name = "myDataSource")
  public DataSource becscmDataSource(CloudFactory cloudFactory) {
    return createDataSource(cloudFactory, "my-maria-rds");
  }
}

ANSWER

Answered 2021-Apr-02 at 13:45

You are using the Spring Cloud Connectors library to create the database connection.

compile group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector', version: '2.0.7.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector', version: '2.0.7.RELEASE'

This library is in maintenance mode, and its use is discouraged. One of the reasons for discouraging its use is that it does not work well with Spring Boot configuration. When Connectors APIs like cloudFactory.getCloud().getServiceConnector() are used to create the service connection bean, Spring Boot auto-configuration backs off and properties like spring.datasource.* are ignored. If there is a reason why you must continue to use Connectors, then you will need to use the Connectors API to configuring pooling options as shown in the documentation.

The better option is to remove the dependency on Connectors and use Java CFEnv instead.

Source https://stackoverflow.com/questions/66912106

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install spring-cloud-cloudfoundry

In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. The following files can be found in the Spring Cloud Build project. Go to File → Settings → Editor → Code style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file. Go to File → Settings → Editor → Inspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file. To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions.
Default Checkstyle rules
File header setup
Default suppression rules
Project defaults for Intellij that apply most of Checkstyle rules
Project style conventions for Intellij that apply most of Checkstyle rules
checkstyle.header.file - please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/main/resources/checkstyle-header.txt file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt URL.
checkstyle.suppressions.file - default suppressions. Please point it to the Spring Cloud Build’s, spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml file either in your cloned repo or via the https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml URL.
checkstyle.additional.suppressions.file - this variable corresponds to suppressions in your local project. E.g. you’re working on spring-cloud-contract. Then point to the project-root/src/checkstyle/checkstyle-suppressions.xml folder. Example for spring-cloud-contract would be: /home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml.

Support

The spring-cloud-build module has a "docs" profile, and if you switch that on it will try to build asciidoc sources from src/main/asciidoc. As part of that process it will look for a README.adoc and process it by loading all the includes, but not parsing or rendering it, just copying it to ${main.basedir} (defaults to ${basedir}, i.e. the root of the project). If there are any changes in the README it will then show up after a Maven build as a modified file in the correct place. Just commit it and push the change.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Microservice Libraries
Compare Microservice Libraries with Highest Support
Compare Microservice Libraries with Highest Security
Compare Microservice Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.