Validate with java & Spring

Posted on by Kim

import javax.validation.constraints.NotNull;

public class Car {

    @NotNull
    private String name;
}
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;

@Service
@Validated
public class CarService {

    public save(@Valid Car car) {
        // TODO
    }
}

Lambda in Angular (typescript)

Posted on by Kim

return books.bar.filter(function (x) {
  return x.id === null;
}).length;

change to

return books.bar.filters(b => b.id === null).length;

@Slf4j
@RequiredArgsConstructor
@Configuration
public class SslConfig {

    private final SslSettings sslSettings;

    @PostConstruct
    void init() {
        String truststore = sslSettings.getTruststore();
        if (truststore != null) {
            log.info("Setting truststore: {}", truststore);
            System.setProperty("javax.net.ssl.trustStore", truststore);
        } else if (System.getProperty("javax.net.ssl.trustStore") != null) {
            log.info("Using provided truststore: {}", System.getProperty("javax.net.ssl.trustStore"));
        } else {
            throw new IllegalStateException("No truststore found!");
        }
    }
}