Package org.springframework.core.io

Examples of org.springframework.core.io.ClassPathResource


    @Bean
    public Mongeez mongeez() {
        log.debug("Configuring Mongeez");
        Mongeez mongeez = new Mongeez();
        mongeez.setFile(new ClassPathResource("/config/mongeez/master.xml"));
        mongeez.setMongo(mongo);
        mongeez.setDbName(mongoProperties.getDatabase());
        mongeez.process();
        return mongeez;
    }<% } %>
View Full Code Here


    appAuthGoogle = new GoogleTemplate("APP_ACCESS_TOKEN");
    appAuthMockServer = MockRestServiceServer.createServer(appAuthGoogle.getRestTemplate());
  }
 
  protected Resource jsonResource(String filename) {
    return new ClassPathResource(filename + ".json", getClass());
  }
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception{
    RestTemplate template = new RestTemplate();
    Resource s2logo = new ClassPathResource(resourcePath);
    MultiValueMap<String, Object> multipartMap = new LinkedMultiValueMap<String, Object>();
    multipartMap.add("company", "SpringSource");
    multipartMap.add("company-logo", s2logo);
    logger.info("Created multipart request: " + multipartMap);
    HttpHeaders headers = new HttpHeaders();
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception{
    ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/http-outbound-config.xml");
    Resource s2logo = new ClassPathResource(resourcePath);
    Map<String, Object> multipartMap = new HashMap<String, Object>();
    multipartMap.put("company", new String[]{"SpringSource", "VMWare"});
    multipartMap.put("company-logo", s2logo);
    logger.info("Created multipart request: " + multipartMap);
    MultipartRequestGateway requestGateway = context.getBean("requestGateway", MultipartRequestGateway.class);
View Full Code Here

    assertThat(source, is(instanceOf(List.class)));
    List<?> list = (List<?>) source;
    assertThat(list, is(not(empty())));
    Object element = list.get(0);
    assertThat(element, is(instanceOf(ClassPathResource.class)));
    ClassPathResource resource = (ClassPathResource) element;
    assertThat(resource.getPath(), is(path));
  }
View Full Code Here

  private static ClassPathResource getPopulatorResource() {

    String springVersion = SpringVersion.getVersion();
    String populatorsResourceName = springVersion.startsWith("4") ? "populators-spring-4.0.xml" : "populators.xml";

    return new ClassPathResource(populatorsResourceName,
        ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests.class);
  }
View Full Code Here

  @Test
  public void readsFileWithMultipleObjects() throws Exception {

    ResourceReader reader = new Jackson2ResourceReader();
    Object result = reader.readFrom(new ClassPathResource("data.json", getClass()), null);

    assertThat(result, is(instanceOf(Collection.class)));
    assertThat((Collection<?>) result, hasSize(1));
  }
View Full Code Here

    messageChannel.send(orderMessage);
    applicationContext.close();
  }

  private static GenericMessage<Document> createXmlMessageFromResource(String path) throws Exception {
    Resource orderRes = new ClassPathResource(path);

    DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
    builderFactory.setNamespaceAware(true);
    DocumentBuilder builder = builderFactory.newDocumentBuilder();

    Document orderDoc = builder.parse(orderRes.getInputStream());
    return new GenericMessage<Document>(orderDoc);
  }
View Full Code Here

    });
  }

  private PublicKey decodePublicKey() throws Exception {
    InputStream stream = new ClassPathResource("META-INF/keys/sftp_rsa.pub").getInputStream();
    byte[] decodeBuffer = Base64.decodeBase64(StreamUtils.copyToByteArray(stream));
    ByteBuffer bb = ByteBuffer.wrap(decodeBuffer);
    int len = bb.getInt();
    byte[] type = new byte[len];
    bb.get(type);
View Full Code Here

        DefaultValidationRuleElementHandlerRegistry registry = new DefaultValidationRuleElementHandlerRegistry();
        registry.setConditionExpressionParser(conditionExpressionParser);
        registry.afterPropertiesSet();

        DefaultXmlBeanValidationConfigurationLoader loader = new DefaultXmlBeanValidationConfigurationLoader();
        loader.setResource(new ClassPathResource("validation.xml", getClass()));
        loader.setElementHandlerRegistry(registry);
        loader.afterPropertiesSet();

        BeanValidator validator = new BeanValidator(loader);
        validator.setErrorCodeConverter(new DefaultErrorCodeConverter());
View Full Code Here

TOP

Related Classes of org.springframework.core.io.ClassPathResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.