Skip to main content

v5.0.0 (2026-07-14)

<dependency>
<groupId>net.hasor</groupId>
<artifactId>hasor-core</artifactId>
<version>5.0.0</version>
</dependency>

Version 5.0 raises the runtime baseline to Java 17, reorganizes Core configuration, object providers, and startup APIs, and uses Cobble for shared infrastructure.

Scope

  • Java runtime, Core startup and extension APIs, Web container integration, and JSON responses

Changes

  • Added
    • Provide Hasor.run(args, primarySources) for quick startup, with startup argument binding, primary source registration, and shutdown hook control.
    • Add AppContext.toBeanMap(), toTypeMap(), and toNameMap() to access Beans through Maps by binding ID, type, or name.
    • Add WebServers, WebServerConfig, and WebServerProvider to Web for creating, configuring, and discovering embedded HTTP containers.
  • Improved
    • Use Cobble for shared utilities, configuration, resource loading, class scanning, and dynamic proxies.
    • Use Java Supplier for object provider APIs, and Cobble for scope and interceptor interfaces.
    • Remove the separate Environment abstraction; expose configuration, events, resource loaders, and class loaders directly through AppContext.
  • Fixed
    • Restore the javax.annotation-api dependency to support @PostConstruct and @PreDestroy lifecycle annotations.

Upgrade notes

  • Use Java 17 or later for building and running applications. Applications on 4.x must adapt their source and recompile; replacing dependencies alone is insufficient.
  • The original net.hasor.core.Settings, Scope, AOP, and shared utility APIs have changed or moved to Cobble. Update custom containers, scopes, and interceptors.
  • Adapt business extensions using the original Provider type to the new Supplier APIs; access capabilities previously obtained through getEnvironment() through AppContext.
  • @InjectSettings now reads configuration consistently from Settings. The ${...} syntax still strips its delimiters, but no longer reads environment variables directly through the old Environment. Create corresponding configuration keys for previous environment variable injection; explicitly specify packages when using class scanning APIs.
  • The built-in JsonRenderEngine still uses Fastjson but no longer explicitly enables WriteMapNullValue. Check response formats or customize the renderer for APIs that depend on null fields being included.