Git Product home page Git Product logo

multitenant-spring-boot-app's Introduction

Multi-tenant Spring Boot App

This repository contains an example of Spring Boot Application with implementation of:

  1. XSUAA security integration
  2. Multitenancy: Tenant-onboarding, Schema-Per-Tenant data Isolation
  3. SAP HANA Cloud integration
  4. MTA-based configuration
  5. Liquibase integration

Deployment process

1. Preparation

MTA Applications are delivered to SAP BTP platform as a .mtar archive

First of all you need to install multiapps plugin to CF CLI tool.

cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org
cf install-plugin multiapps

and install mbt plugin

npm install -g mbt

2. Build .mtar archive

Perform mbt build in the root folder of repository. Resulting archive should be placed in mta_archives directory.

3. Deployment

Perform cf deploy <path_to_mtar_file> command.

4. Following the deployment

The process and result of deployment process will be logged into the console. If something went wrong, the most convenient way to find an issue is to look into the logs of deployed application.

Configuring SAP HANA Cloud

To allow application to perform multitenant logic you should provide used of deployed permission to manage schemas. You can find the user in binding of deployed application.

Perform this query in Database Explorer: GRANT CREATE SCHEMA TO <username>

Configuring routes

Each application consumer requires route to be configured:
cf map-route <app-name> cfapps.us10-001.hana.ondemand.com --hostname <subaccount-subdomaint>-<app-name>
source

Troubleshooting

Unable to instantiate JwtDecoder bean

JwtDecoder bean requires RestOperations bean to be available in the context. RestOperations requires htppclient5 dependency which can be not provided automatically.

@Bean
	@ConditionalOnMissingBean
	@ConditionalOnClass(name = "org.apache.hc.client5.http.impl.classic.CloseableHttpClient")
	@ConditionalOnBean(XsuaaServiceConfiguration.class)
	public RestOperations xsuaaMtlsRestOperations(XsuaaServiceConfiguration xsuaaServiceConfiguration) {
		return SpringHttpClientFactory.createRestTemplate(xsuaaServiceConfiguration.getClientIdentity());
	}

To fix this add to pom.xml:

<dependency>
    <groupId>org.apache.httpcomponents.client5</groupId>
    <artifactId>httpclient5</artifactId>
    <version>5.3.1</version>
</dependency>

multitenant-spring-boot-app's People

Contributors

marshallbaby avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.