Skip to Content
0
May 18, 2020 at 01:52 PM

Using external dependency in Java bean annotation

208 Views

Let's say I want to use opencsv. I have added the dependency in `external-dependencies.xml` asked to download the dependency by saying usemaven='true'. The jar file is downloaded and stored in the lib folder of the extension.

Now if I want to use this dependency to generate Java bean which contains annotation example.

<bean class="com.something.dto.IndirectSaleData">
    <import type="com.opencsv.bean.CsvBindByName"/>
    <property name="firstName" type="java.lang.String">
        <annotations>@CsvBindByName(column = "first_name", required = true)</annotations>
    </property>
</bean>

Why is it not able to resolve the dependency?

On the other hand if I directly create the Java Class it works totally fine example-

import com.opencsv.bean.CsvBindByName;
public class Data {

    @CsvBindByName(column = "first_name", required = true)
    private String name;

}