Skip to content
CONTEXT MAPPER
  • Docs
  • Language Reference
  • Generators
  • News
  • Background
  • Get Involved
    Introduction
    • Welcome
    • Getting started
    • Create CML Project
    • Examples
    • Usage as Library
    • Frequently Asked Questions
    Language Reference (Core)
    • CML Reference - Introduction
    • Language Semantics
    • Context Map
    • Bounded Context
    • Domain and Subdomain
    • Domain Vision Statement
    • Partnership
    • Shared Kernel
    • Customer/Supplier
    • Conformist
    • Open Host Service
    • Anticorruption Layer
    • Published Language
    • Responsibility Layers
    • Knowledge Level
    • Aggregate
    • Tactic DDD Syntax
    • Application and Process Layer
    • User Requirements
    • Stakeholders
    • Value Registers
    • Imports
    Analysis and Design Transformations
    • Rapid Object-oriented Analysis and Design
    • Story Splitting (PoC)
    • Stakeholder and Value Modelling Transformations
    Architectural Refactorings (ARs)
    • Architectural Refactorings
    • AR-1: Split Aggregate by Entities
    • AR-2: Split Bounded Context by Features
    • AR-3: Split Bounded Context by Owner
    • AR-4: Extract Aggregates by Volatility
    • AR-5: Extract Aggregates by Cohesion
    • AR-6: Merge Aggregates
    • AR-7: Merge Bounded Contexts
    • AR-8: Extract Shared Kernel
    • AR-9: Suspend Partnership
    • AR-10: Change Shared Kernel to Partnership
    • AR-11: Change Partnership to Shared Kernel
    Value-Driven Analysis and Design
    • Value-Driven Analysis and Design (VDAD) Support
    Service Cutter
    • Context Map Suggestions with Service Cutter
    • Service Cutter Configuration File (.servicecutter.yml)
    Reverse Engineering
    • Context Map Discovery
    Generators
    • Generators Overview
    • Context Map Generator
    • PlantUML Generator
    • BPMN Sketch Miner Generator
    • MDSL (Micro-)Service Contracts Generator
    • Service Cutter Generators
    • Generic Generator (Templating)
    Tutorials
    • Model Event Storming Results in Context Mapper
    • Event Sourcing and CQRS Modeling in Context Mapper
    • Generate Microservices From Context Map Using JHipster
    • Systematic Service Decomposition with Context Mapper and Service Cutter
    • Validating the Implementation against the Model (with ArchUnit)
    IDE Plugins and Extensions
    • Visual Studio Code Extension
    • Online IDE (no longer supported)
    • Eclipse Plugin
    • Feature Support

    Shared Kernel

    The Shared Kernel pattern describes a relationship between two bounded contexts and is used on a context map in CML. The Language Semantics page describes all relationship types that are supported in CML.

    Syntax

    Note that currently two different syntax variants exist. The following code snippets illustrate both variants:

    CargoBookingContext [SK]<->[SK] VoyagePlanningContext {
      implementationTechnology = "Java Library"
    }
    

    Note that with this syntax (with the arrows <->) it does not matter which bounded context is on which side, since this is a symmetric relationship. If you switch the bounded contexts, it has the same meaning semantically.

    CargoBookingContext Shared-Kernel VoyagePlanningContext {
      implementationTechnology = "Java Library"
    }
    

    Default Symmetric Relationship

    Note that the Shared Kernel is the default symmetric relationship. Omitting the concrete relationship type within the brackets as follows, declares a Shared Kernel relationship too. However, with this syntax a reader has to know this behavior and cannot explicitly see that it is not a Partnership relationship:

    CargoBookingContext <-> VoyagePlanningContext
    

    Implementation Technology

    With the implementationTechnology keyword you can specify how the relationship is implemented.

    Relationship Name

    With a colon it is possible (optionally) to add a relationship name to the specification, as illustrated within this example:

    CargoBookingContext Shared-Kernel VoyagePlanningContext : BookingVoyageRelationship {
      implementationTechnology = "Java Library"
    }
    
    Improve this page on GitHub
    ← PreviousPartnership Next →Customer/Supplier
    © 2026 Context Mapper contributors
    • GitHub
    • Get Involved
    • Background & Publications
    • RSS