Bug description

It's not obvious to me how to run Vector Store unit tests without adding a bunch of code to manually setup TransformersEmbeddingModel. I needed to add the following code to run unit tests to the following file to get TransformersEmbeddingModel to work

https://docs.spring.io/spring-ai/reference/api/embeddings/onnx.html#_manual_configuration

I needed to replace this code

https://github.com/spring-projects/spring-ai/blob/9cf66333b5f0e36753f1a74931a59b8ace68bdec/vector-stores/spring-ai-azure-store/src/test/java/org/springframework/ai/vectorstore/azure/AzureVectorStoreIT.java#L316-L318

With

public EmbeddingModel embeddingModel() {
    var embeddingModel = new TransformersEmbeddingModel();

    // (optional) defaults to classpath:/onnx/all-MiniLM-L6-v2/tokenizer.json
    embeddingModel.setTokenizerResource("file:/C:\\path\\to\\tokenizer.json");

    embeddingModel.setModelResource("file:/C:\\path\\to\\model.onnx");

    embeddingModel.setResourceCacheDirectory("C:\\path\\to\\tmp");

    try {
        embeddingModel.afterPropertiesSet();
    }
    catch (Exception e) {
        fail(e.getMessage());
    }

    return embeddingModel;
}

After following the setup steps (export to ONNX, etc...)

Environment Spring AI Version: main branch openjdk version "17.0.7" 2023-04-18 LTS OpenJDK Runtime Environment Microsoft-7626293 (build 17.0.7+7-LTS) OpenJDK 64-Bit Server VM Microsoft-7626293 (build 17.0.7+7-LTS, mixed mode, sharing)

Steps to reproduce 1. Try to run any vector store unit tests that initialize TransformersEmbeddingModel

Expected behavior 1. No need for any replacement code

Comment From: mattgotteiner

even calling afterPropertiesSet without any additional setup fixed the issue. and if you fetch it via the Bean it automatically calls this method