Giter Site home page Giter Site logo

jhendess / spring-boot-starter-threadscope Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devbury/spring-boot-starter-threadscope

0.0 2.0 1.0 35 KB

Thread scope that supports asynchronous threads and bean destruction callbacks

License: Apache License 2.0

Java 100.00%

spring-boot-starter-threadscope's Introduction

spring-boot-starter-threadscope

A Spring Boot starter that sets up a "thread" scope similar to [SimpleThreadScope] (http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/support/SimpleThreadScope.html). The difference being spring-boot-starter-threadscope supports destruction callbacks such as @PreDestroy and propagates thread scoped beans to asynchronous threads. Thread scope works in regular application contexts as well as web application contexts. It can be used to replace Spring's request scope.

Activating

spring-boot-starter-threadscope is published to the jcenter and maven central repositories. To use the starter, add the following dependency information to your project.

<dependency>
    <groupId>com.devbury</groupId>
    <artifactId>spring-boot-starter-threadscope</artifactId>
    <version>1.1.0</version>
</dependency>

To build and install the project from source, clone the Git repository and run

mvn clean install

The starter provides you with a configured thread scope and a task executor that will propagate thread scoped beans to asynchronous tasks.

Configuring

Properties

The following properties may be set in your application.properties file to override default values.

thread-scope.pool-size=25
thread-scope.thread-name-prefix=async-
thread-scope.scope-name=request

The default setting of threadScope.scopeName=request will replace the default web request scope with the starter's thread based scope and all existing request scoped beans will use the new thread scope. If you want to use both the existing request scope and the new thread scope, change the value of this setting.

Default Beans

spring-boot-starter-threadscope will configure a default working environment but will remove the defaults based on the beans configured in your application. If an AsyncConfigurer is not already already defined one will be registered. A default SimpleAsyncUncaughtExceptionHandler will be defined if an AsyncUncaughtExceptionHandler is not defined. A ThreadScopePropagatingScheduler that can propagate the scheduling thread's scope to threads in the pool will be used unless another implementation is provided.

spring-boot-starter-threadscope's People

Contributors

david-noel avatar jhendess avatar

Watchers

 avatar  avatar

Forkers

usiel

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.