softwaremill/macwire
61.6
Adequate · 27 September 2026
4k
lines of production code
Scala
primary language
4
measurements over time
What this system is
This system is a compile-time dependency injection library for Scala that provides macro-based wiring for objects, actors, and effectful resources. It supports both Scala 2 and Scala 3, offering features like automatic autowiring, recursive dependency resolution, and scoped instance management via runtime proxies. The library includes specialized modules for integrating with Akka, Pekko, and Cats Effect, alongside comprehensive examples for Play and Scala.js applications.
How it got here
2013–2015 — Build modernization and core feature expansion
18 changes.
The project modernized its build infrastructure by migrating to SBT 1.13 and updating dependencies, while significantly expanding test coverage for dependency injection and scoping mechanisms. New features were introduced, including AOP proxying, runtime wiring utilities, and comprehensive examples for Scalatra, Play 2.4, and Scala.js to demonstrate these capabilities.
2016–2021 — Scala 3 migration and macro expansion
16 changes.
The project introduced native Scala 3 support for its dependency injection macros, including a new autowire feature and comprehensive compile-time test infrastructure for both Scala 2 and 3. Significant enhancements included adding factory-based wiring for Akka actors, recursive dependency resolution, and Cats Effect integration, alongside extensive refactoring of macro internals to support call-by-name parameters and Jakarta annotations.
2023–2024 — Scala 3 and Pekko macro support
5 changes.
This period focused on expanding the macwire library with new macro capabilities for Apache Pekko actors and native Scala 3 support. Key developments included implementing autowiring features with Jakarta Inject compatibility and adding comprehensive integration tests to ensure robust dependency resolution.
Features
Add Akka actor wiring macros with factory support
The macrosAkka module now provides macros for wiring Akka actors, including standard methods like wireProps, wireActor, and wireAnonymousActor, as well as new variants (wirePropsWith, wireActorWith, wireAnonymousActorWith) that accept a factory function to create the actor instance. This allows users to wire actors using custom factory logic or IndirectActorProducer implementations in addition to the default constructor-based wiring.
macrosAkka · high confidence
Add Pekko actor wiring macros
This change introduces the \macrosPekko\ module, providing a new set of compile-time macros for wiring Apache Pekko actors. It adds \wireProps\, \wireActor\, and \wireAnonymousActor\ functions that automatically resolve constructor dependencies for actor classes, as well as \wirePropsWith\, \wireActorWith\, and \wireAnonymousActorWith\ variants that support custom factory functions with up to 26 parameters. This allows users to create Pekko \Props\ and \ActorRef\ instances without manually specifying constructor arguments or producer classes.
macrosPekko · high confidence
Add Scala.js example demonstrating Macwire dependency injection
A new Scala.js example has been added to the examples/scalajs directory, showcasing how to use Macwire for dependency injection in a browser environment. The example includes a MainModule trait that wires business logic components and a JSApp entry point that interacts with the DOM to display results.
examples/scalajs · high confidence
Add autowire macro for Cats Effect Resource and IO
The macrosAutoCats module now provides an \autowire\ macro that constructs dependency graphs and returns a \cats.effect.Resource\[IO, T\]\. This allows users to automatically resolve dependencies, including those wrapped in \cats.effect.IO\ or \cats.effect.Resource\, into a single managed resource, simplifying the setup of effectful applications.
macrosAutoCats · high confidence
Add wireRec for recursive dependency resolution
The macwire library now supports resolving recursive dependency graphs via the new \wireRec\ macro. This allows users to wire types that have circular dependencies, which were previously unsupported by the standard \wire\ macro. The implementation is located in the Scala 2 macro source directory, alongside existing macros like \wire\, \wireWith\, and \wireSet\.
macros/src/main/scala-2/com/softwaremill/macwire · high confidence
Added Coffee and Supplier data models to Play 2.4 example
The Play 2.4 example project now includes domain models for Coffee and Supplier, featuring Slick table definitions with H2 database integration and Play JSON serialization. This adds the foundational data layer for the example application, enabling database-backed operations for coffee and supplier entities.
play24 · high confidence
Added Scala.js example demonstrating money earning logic
The scalajs example directory now includes two new Scala source files: \EarnLotsOfMoney.scala\ and \MoneyEarningBusinessLogic.scala\. These files provide a concrete example of how to structure business logic for Scala.js, specifically illustrating a simple money-earning workflow where \EarnLotsOfMoney\ delegates to \MoneyEarningBusinessLogic\ to return a formatted string indicating the amount earned.
scalajs · high confidence
Added base compile test support infrastructure
Introduced the \BaseCompileTestsSupport\ trait in the test-util module, providing a reusable framework for validating compile-time behavior. This component enables test suites to automatically discover and execute test cases based on file suffixes (.success, .failure, .warning), verify expected compilation failures and warnings, and resolve code directives via an include mechanism, thereby standardizing how compile-time checks are structured and executed.
test-util/src/main/scala · high confidence
Adds Scala 3 autowiring and collection wiring capabilities
This change introduces the Scala 3 implementation of the macwire library, adding the \autowire\ macro to create instances using explicitly provided dependencies (including \autowireMembersOf\ to expose specific instance members as dependencies) and the \wire\ macro to resolve dependencies from the surrounding context. It also adds \wireList\ and \wireSet\ to collect all available instances of a type from the context, and \wireRec\ for recursive wiring, alongside the existing \wireWith\ overloads for factory functions.
macros/src/main/scala-3/com/softwaremill/macwire · high confidence
Autowire implementation for Scala 3
The library now supports the \autowire\ macro in Scala 3, allowing users to automatically resolve dependencies without manually specifying them. This change introduces Scala 3-specific internal implementations for finding eligible values (\EligibleValuesFinder\), building the dependency graph (\AutowireGraph\), and resolving providers (\AutowireProviders\), mirroring the existing Scala 2 functionality to enable transparent dependency injection in Scala 3 projects.
repository · high confidence
Introduce Scala 3 macro implementation for dependency injection
This change adds the internal Scala 3 macro implementation for the macwire library, enabling automatic dependency injection in Scala 3 projects. The new code introduces \ConstructorCrimper\ to handle instantiation via public constructors or \@javax.inject.Inject\/\@jakarta.inject.Inject\ annotations, and \CompanionCrimper\ to support companion object \apply\ methods. It also includes \DependencyResolver\ for resolving implicit dependencies, \Logger\ for debug tracing, and macro entry points in \MacwireMacros\ that expose \wire\, \wireRec\, \wireWith\, \wireList\, and \wireSet\ capabilities to users.
macros/src/main/scala-3/com/softwaremill/macwire/internals · high confidence
Introduction of AOP proxying and scoped instance management
The proxy module now provides the core infrastructure for aspect-oriented programming and scoped dependency management. It introduces an interceptor framework (Interceptor, InvocationContext, ProxyingInterceptor) that uses Javassist to weave method handlers around objects, allowing behavior to be intercepted at runtime. Additionally, it implements a scoping system (Scope, ProxyingScope, ThreadLocalScope) that manages the lifecycle of instances, ensuring that scoped objects are created once per thread and reused via thread-local storage.
proxy/src/main · high confidence
New MacWire and Scalatra example with request/session scopes and interceptors
The examples/scalatra directory now contains a complete working example demonstrating how to integrate MacWire with Scalatra. This example introduces request and session scoping for dependencies (such as LoggedInUser and SubmittedData) via a ScopeFilter, and demonstrates the use of interceptors (TimingInterceptor) to wrap service calls. It includes the necessary servlets, logic modules, and Scalate views to showcase these features in a web application context.
examples/scalatra · high confidence
New Play 2.4 and Scala.js examples added
Added a new Play 2.4 example demonstrating integration with MacWire and Play-Slick, featuring controllers for coffee and supplier data, DAOs using Slick with H2, and unit/integration tests. Also added a Scala.js example showing MacWire working with Scala.js, including a simple UI with a button that triggers a wired object graph method.
examples · high confidence
New runtime wiring utilities and experimental module annotation
The util module now includes runtime support for dynamic instantiation and instance lookup, allowing users to wire classes by name or look up implementations by type at runtime via the new Wired class and its supporting traits. Additionally, an experimental @Module annotation (with CLASS retention) is introduced to automatically expose class members for dependency injection, simplifying module composition by removing the need for explicit imports of module members.
util · high confidence
Scala 3 autowiring implementation with Jakarta Inject support
The library now includes a new autowiring implementation specifically for Scala 3, located in the \autowire\ package. This feature enables automatic dependency injection by resolving constructors and companion \apply\ methods, while also detecting \@jakarta.inject.Inject\ annotations (in addition to the existing \@javax.inject.Inject\ support). The implementation includes internal utilities for error reporting with wiring paths, unique name generation, and cycle detection to ensure robust dependency resolution.
macros/src/main/scala-3/com/softwaremill/macwire/internals/autowire · high confidence
Behavioural changes
Build system modernized with SBT 1.13 and new plugin architecture
The project has migrated from the legacy SBT 0.12 build definition to SBT 1.13, replacing the old \project/Build.scala\ with a modern plugin-based setup. This change upgrades core tooling including \sbt-scalajs\ to 1.22.0, \sbt-scala-native\ to 0.5.12, and \sbt-projectmatrix\ to 0.11.0, while adopting the \sbt-softwaremill-common\ and \sbt-softwaremill-publish\ plugins (v2.1.2) for standardized publishing and configuration.
project · high confidence
Modernized project infrastructure and documentation
The project has been modernized with new tooling and configuration files: a Mergify configuration automates CI merges for specific build files, Scala Steward is configured to pin specific versions of Akka and Scala libraries, and Scalafmt is set to version 3.9.10 with dialects for both Scala 2.13 and Scala 3. The .gitignore has been expanded to exclude IDE and build tool artifacts (Metals, Bloop, VS Code, etc.), and the README has been significantly expanded to include a banner, badges, a table of contents, and detailed documentation for autowire, wire, and other features.
(repo-wide) · high confidence
Play 2.4 example now uses Play-Slick and MacWire for dependency injection
The Play 2.4 example application has been migrated to use Play-Slick for database access and MacWire for dependency injection. This change introduces a new application loader that configures logging and wires components like the router and assets using MacWire's \wire\ macro. Additionally, a new \Seed\ component has been added to initialize the database with sample supplier and coffee data upon startup, replacing previous initialization methods.
examples/play24/app/com/softwaremill/play24 · high confidence
Play 2.4 example refactored to use Play-Slick and macwire for dependency injection
The Play 2.4 example application has been updated to use the Play-Slick library for database access and the macwire library for dependency injection. The module structure has been reorganized into three new traits: DatabaseModule, which extends SlickComponents to provide database configuration; DaoModule, which uses macwire to wire the CoffeeDao and SupplierDao; and ControllerModule, which uses macwire to wire the SupplierController and CoffeeController, relying on the DAOs and other dependencies like WSClient. This change replaces the previous DI approach with a macro-based wire implementation and integrates Slick for data access.
examples/play24/app/com/softwaremill/play24/modules · high confidence
Refactored macro internals to support call-by-name parameters and Jakarta injection
The internal macro implementation has been restructured into dedicated components (CompanionCrimper, ConstructorCrimper, DependencyResolver) to improve wiring logic. This change adds support for call-by-name parameters, allowing them to be correctly resolved during dependency injection, and extends constructor detection to recognize @jakarta.inject.Inject annotations alongside the existing @javax.inject.Inject support.
macros/src/main/scala-2/com/softwaremill/macwire/internals · high confidence
Test coverage
Added Akka support test suite and demo; Added Pekko macro integration tests; Added Scala 2-specific compile test support; Added Scala 3 compile-time test infrastructure; Added Scala 3 compile-time tests for autowiring and general wiring error scenarios; Added Scala 3 compile-time tests for tagged parameter error handling; Added code generation tests for wireWith macro signatures; Added compile-time tests for dependency injection ambiguity and error detection; Added test cases for autowire functionality; Added test cases for tagged parameters, module inheritance, and collection wiring; Added test resource fixtures for dependency and trait inspection; Added tests for implicit parameter resolution and module scoping; Added tests for proxying interceptors and thread-local scoping; Added tests for the Wired dependency injection utility; Expanded compile-time tests for Cats Effect autowiring; Expanded test coverage for Akka actor wiring macros; Expanded test coverage for dependency injection scenarios.
Dependencies
Update build dependencies and Scala versions
The build configuration has been updated to use Scala 2.12.21, 2.13.18, and 3.3.8, with Scala 2.11 support removed. Key library dependencies have been upgraded, including cats-core to 2.13.0, cats-effect to 3.7.1, pekko-actor to 1.7.0, akka-actor to 2.6.21, javassist to 3.33.0-GA, and scalatest to 3.2.20. The project matrix now supports JVM, JS, and Native platforms for Scala 2 and 3, and example projects for Play 2.4 and Scala.js have been added.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 44 → 62 (+17.5)
- Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 96 (-3.8)
- Architecture 69 → 100 (+31.0)
- Maturity 57 → 59 (+1.6)
- Readiness 26 → 64 (+37.7)
- Security 53 → 53 (+0.0)
Resolved (6)
- Dimension evaluation failed
- No automated tests
- No exposed public API
- No tests found
- Test reliability not included
- The Play 2.4 section mentions GlobalSettings and ApplicationLoader but does not explain how to replace them with the new ApplicationLifecycle trait or add a stop hook, which is critical for dependency injection. (examples/play24/README.md)
New (24)
- Concentrated knowledge decay
- Duplicated block (12 lines × 2) (macros/src/main/scala-2/com/softwaremill/macwire/internals/EligibleValuesFinder.scala)
- Duplicated block (20 lines × 2) (macrosAkka/src/main/scala/com/softwaremill/macwire/akkasupport/MacwireAkkaMacros.scala)
- Duplicated block (29 lines × 2) (macros/src/main/scala-2/com/softwaremill/macwire/internals/Logger.scala)
- Duplicated block (5 lines × 2) (macros/src/main/scala-2/com/softwaremill/macwire/internals/EligibleValuesFinder.scala)
- Duplicated block (53 lines × 2) (macrosAkka/src/main/scala/com/softwaremill/macwire/akkasupport/internals/Crimper.scala)
- Duplicated block (7 lines × 2) (macros/src/main/scala-3/com/softwaremill/macwire/internals/EligibleValuesFinder.scala)
- EligibleValuesFinder.find (cognitive 32) (macros/src/main/scala-2/com/softwaremill/macwire/internals/EligibleValuesFinder.scala)
- EligibleValuesFinder.find (cyclomatic 22) (macros/src/main/scala-2/com/softwaremill/macwire/internals/EligibleValuesFinder.scala)
- FixmeComment (macros/src/main/scala-3/com/softwaremill/macwire/internals/CompanionCrimper.scala)
- FixmeComment (macros/src/main/scala-3/com/softwaremill/macwire/internals/EligibleValuesFinder.scala)
- FixmeComment (macros/src/main/scala-3/com/softwaremill/macwire/internals/MacwireMacros.scala)
- FixmeComment (util-tests/src/test/scala-3/com/softwaremill/macwire/CompileTests.scala)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- Off-boarding risk: anonymized user #1
- PR-triggered workflow without a permissions block
- …and 4 more
Changes since last survey
- 5 commits — 5 feature/other, 0 fixes
By area
- (root) — 3 commits
- project/build.properties — 2 commits
Notable commits
- change: Update cats-effect to 3.7.1 (#481)
- change: Update javassist to 3.33.0-GA (#480)
- change: Update pekko-actor to 1.7.0 (#477)
- change: Update sbt, scripted-plugin to 1.12.15 (#475)
- change: Update sbt, scripted-plugin to 1.13.0 (#478)
Architecture
- Containers 0 added · 0 removed · contexts 3 added · 0 removed · edges 1 added · 0 removed
Added bounded contexts (3)
- play24
- repository
- scalajs
Added dependency edges (1)
- scalajs → repository
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
softwaremill/macwire was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 27 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit c51d982d3680518b01e658352c00180a12851b47 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-d00c643c3f66.