spring-jnr

A library to inject JNR native libraries to Spring beans

Лицензия

Лицензия

Категории

Категории

JNR Инструменты разработки Native
Группа

Группа

com.github.goto1134
Идентификатор

Идентификатор

spring-jnr
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

spring-jnr
A library to inject JNR native libraries to Spring beans
Ссылка на сайт

Ссылка на сайт

https://github.com/goto1134/spring-jnr
Система контроля версий

Система контроля версий

https://github.com/goto1134/spring-jnr

Скачать spring-jnr

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.goto1134/spring-jnr/ -->
<dependency>
    <groupId>com.github.goto1134</groupId>
    <artifactId>spring-jnr</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.goto1134/spring-jnr/
implementation 'com.github.goto1134:spring-jnr:1.0'
// https://jarcasting.com/artifacts/com.github.goto1134/spring-jnr/
implementation ("com.github.goto1134:spring-jnr:1.0")
'com.github.goto1134:spring-jnr:jar:1.0'
<dependency org="com.github.goto1134" name="spring-jnr" rev="1.0">
  <artifact name="spring-jnr" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.goto1134', module='spring-jnr', version='1.0')
)
libraryDependencies += "com.github.goto1134" % "spring-jnr" % "1.0"
[com.github.goto1134/spring-jnr "1.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.github.jnr : jnr-ffi jar 2.1.6
org.springframework : spring-context jar 4.3.9.RELEASE

test (3)

Идентификатор библиотеки Тип Версия
org.springframework : spring-test jar 4.3.9.RELEASE
org.hamcrest : hamcrest-all jar 1.3
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

spring-jnr

Spring extension to load native libraries via jnr-ffi.

Tests are written for windows

Get it

Gradle

dependencies {
    compile group: 'com.github.goto1134', name: 'spring-jnr', version: '1.0'
}

Maven

<dependencies>
    <dependency>
      <groupId>com.github.goto1134</groupId>
      <artifactId>spring-jnr</artifactId>
      <version>1.0</version>
      <scope>compile</scope>
    </dependency>
</dependencies>

Use it

  1. Register BeanPostProcessor
@Bean
public BeanPostProcessor nativeLibraryBeanPostProcessor() {
    return new NativeLibraryBeanPostProcessor();
}
  1. Declare configuration qualifier
@Qualifier
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MicrosoftVisualCRuntime {
}
  1. Declare library configuration
@MicrosoftVisualCRuntime
@Component
public class MicrosoftVisualCRuntimeConfiguration
        implements NativeLibraryConfiguration {

    @Override
    public LibraryInfo getLibraryInfo() {
        if (Platform.getNativePlatform()
                    .getOS() != Platform.OS.WINDOWS) {
            throw new IllegalStateException("Must be windows OS");
        }
        return new LibraryInfo("msvcrt", "", CallingConvention.STDCALL, true, IdentityFunctionMapper.getInstance());
    }
}
  1. Mark all libraries with the same qualifier
@MicrosoftVisualCRuntime
public interface PseudoRandomSequenceGenerator {
    int rand();
}
  1. Mark all fields where injection is needed
@NativeLibrary
private PseudoRandomSequenceGenerator generator;

Версии библиотеки

Версия
1.0