i want to link a .so library to a spring project. how can i do that i have written some code anlayse that and give me the chznges for that
package com.example.idemia;

import jnr.ffi.LibraryLoader;
import jnr.ffi.Pointer;

public interface NativeLibrary {
    void keygeneration(Pointer publicKey, Pointer privateKey);
    void encryption(Pointer publicKey, Pointer ciphertext, Pointer message);
    void decryption(Pointer privateKey, Pointer ciphertext, Pointer message);
}
package com.example.idemia;

import jnr.ffi.LibraryLoader;
import jnr.ffi.Pointer;

public class NativeLibraryImpl implements NativeLibrary {
    private static final NativeLibrary LIBRARY_LOADER = LibraryLoader.create(NativeLibrary.class).load("kyber_lib");
    private NativeLibrary nativeLibrary;

    public NativeLibraryImpl() {
        nativeLibrary = LIBRARY_LOADER;
    }

    @Override
    public void keygeneration(Pointer publicKey, Pointer privateKey) {
        nativeLibrary.keygeneration(publicKey, privateKey);
    }

    @Override
    public void encryption(Pointer publicKey, Pointer ciphertext, Pointer message) {
        nativeLibrary.encryption(publicKey, ciphertext, message);
    }

    @Override
    public void decryption(Pointer privateKey, Pointer ciphertext, Pointer message) {
        nativeLibrary.decryption(privateKey, ciphertext, message);
    }
}
package com.example.idemia;

import jnr.ffi.Pointer;

public class Wrapper {
    private NativeLibrary nativeLibrary;

    public Wrapper(NativeLibraryImpl nativeLibraryImpl) {
        nativeLibrary = nativeLibraryImpl;
    }

    public void keyGenerationn(Pointer publicKey, Pointer privateKey) {
        nativeLibrary.keygeneration(publicKey, privateKey);
    }

    public void encryptionn(Pointer publicKey, Pointer ciphertext, Pointer message) {
        nativeLibrary.encryption(publicKey, ciphertext, message);
    }

    public void decryptionn(Pointer privateKey, Pointer ciphertext, Pointer message) {
        nativeLibrary.decryption(privateKey, ciphertext, message);
    }
}
package com.example.idemia;

import jnr.ffi.Pointer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/tests")
public class Controller{
    public String testAllFunctions() {
        NativeLibraryImpl nativeLibraryImpl = NativeLibraryImpl.load();
        Wrapper wrapper = new Wrapper();
    
        // Key generation
        Pointer publicKey = nativeLibraryImpl.malloc(1568); // adjust size as needed
        Pointer privateKey = nativeLibraryImpl.malloc(1536);
        Pointer ciphertext = nativeLibraryImpl.malloc(1568);
        Pointer message = nativeLibraryImpl.malloc(64); // adjust size as needed
    
        // Populate message buffer with some values
        for (int i = 0; i < 32; i++) {
            message.putInt(i * 4, i); // populate with values from 0 to 31
        }
    
        wrapper.keyGenerationn(publicKey, privateKey);
    
        wrapper.encryptionn(publicKey, ciphertext, message);
    
        // Decryption
        wrapper.decryptionn(privateKey, ciphertext, message);
    
        // Free the native memory
        nativeLibraryImpl.free(publicKey);
        nativeLibraryImpl.free(privateKey);
        nativeLibraryImpl.free(ciphertext);
        nativeLibraryImpl.free(message);
    
        return "All done";
    }

}