studerw / td-ameritrade-client

TD Ameritrade Java Client
Apache License 2.0
69 stars 47 forks source link

Using Spring and getting javax.validation.NoProviderFoundException with PriceHistReq Validation #63

Closed CRCoughlin closed 1 year ago

CRCoughlin commented 1 year ago

I've added spring-boot-starter-validation since I'm building a Spring Boot app, and tried hibernate-validator in a mix of combinations, clean, cleared-cached, used "@ Validated" annotation, and declared the Validation bean manually but I keep getting: javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

This is how I'm using the PriceHistReq, and where it throws:

        PriceHistReq req = PriceHistReq.Builder.priceHistReq()
                .withSymbol(symbol)
                .withPeriodType(PeriodType.valueOf(periodType))
                .withPeriod(period)
                .withFrequencyType(FrequencyType.valueOf(frequencyType))
                .withFrequency(frequency)
                .withStartDate(startDate)
                .withEndDate(endDate)
                .withExtendedHours(extendedHours)
                .build();
        HttpTdaClient tdaClient = new HttpTdaClient();
        PriceHistory priceHistory = tdaClient.priceHistory(req);

at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:291) ~[validation-api-2.0.1.Final.jar:na] at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:103) ~[validation-api-2.0.1.Final.jar:na] at com.studerw.tda.model.history.PriceHistReqValidator.(PriceHistReqValidator.java:20) ~[td-ameritrade-client-2.4.1.jar:na] at com.studerw.tda.client.HttpTdaClient.priceHistory(HttpTdaClient.java:188) ~[td-ameritrade-client-2.4.1.jar:na]