List of usage examples for org.springframework.core.io ClassPathResource ClassPathResource
public ClassPathResource(String path)
From source file:com.ullgren.pontus.mule.module.cb2java.Copybook2JavaExtensionModule.java
/** * Custom processor//ww w. ja va2 s . c o m * * {@sample.xml ../../../doc/Copybook2JavaExtension-connector.xml.sample copybook2javaextension:copybook-to-record} * * @param content Content to be processed * @return Some string * @throws IOException */ @Processor public List<Record> copybookToRecord(@Payload final InputStream input) throws IOException { Resource resource = new ClassPathResource(getCopybook()); // Parse copybook Copybook copybook = CopybookParser.parse(this.copybookName, resource.getInputStream()); // Parse data List<Record> results = copybook.parseData(input); return results; }
From source file:com.eventattend.portal.Factory.UserFactory.java
public static UserController updateProfileSettings() throws Exception { ClassPathResource resource = new ClassPathResource("BusinessObjectFactory.xml"); BeanFactory factory = new XmlBeanFactory(resource); return (UserController) factory.getBean("updateProfileSettings"); }
From source file:example.UserInitializer.java
public void initLocally() throws Exception { List<User> users = readUsers(new ClassPathResource("randomuser.me.csv")); repository.deleteAll();/* w w w.j a v a2s. co m*/ repository.save(users); }
From source file:occi.config.SpringOcciConfig.java
@Bean public static PropertySourcesPlaceholderConfigurer properties() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); Resource[] resources = new ClassPathResource[] { new ClassPathResource("OCCI.properties") }; pspc.setLocations(resources);//ww w .j a va2s.c om pspc.setIgnoreUnresolvablePlaceholders(true); return pspc; }
From source file:net.javacrumbs.springws.test.common.MessageGeneratorTest.java
@Test public void testDetectCreateEnvelope2() throws IOException { MessageGenerator generator = new MessageGenerator(); assertFalse(generator//from w ww . j ava2s . com .shouldCreateSoapEnvelope(new ClassPathResource("mock-responses/test/default-response.xml"))); }
From source file:org.pdfsam.community.PdfsamCommunityConfig.java
@Bean(name = "logo") public Group logo() throws IOException { Resource resource = new ClassPathResource("/fxml/LogoCommunity.fxml"); return FXMLLoader.load(resource.getURL()); }
From source file:org.deeplearning4j.spark.util.MLLIbUtilTest.java
@Test public void testMlLibBinaryFiles() throws Exception { JavaPairRDD<String, PortableDataStream> pairRdd = sc .binaryFiles(new ClassPathResource("img.jpg").getFile().toString()); JavaRDD<LabeledPoint> rdd = MLLibUtil.fromBinary(pairRdd, new ImageRecordReader(28, 28)); rdd.foreach(new VoidFunction<LabeledPoint>() { @Override/*ww w. j av a 2s. c om*/ public void call(LabeledPoint labeledPoint) throws Exception { } }); }
From source file:org.openmrs.module.dhisreport.api.DHIS2ReportingServiceDAOTest.java
@Before public void before() throws Exception { _default = new Disaggregation(); _default.setName("default"); _default.setCode("default"); service = Context.getService(DHIS2ReportingService.class); ClassPathResource resource = new ClassPathResource("templates_ethiopia.xml"); service.unMarshallandSaveReportTemplates(resource.getInputStream()); }
From source file:com.intelligentsia.dowsers.entity.manager.ContactTest.java
public Resource getResource() { return new ClassPathResource("dowsers-context-sample1.xml"); }
From source file:org.springframework.hateoas.VndErrorsMarshallingTests.java
public VndErrorsMarshallingTests() throws IOException { jsonReference = readFile(new ClassPathResource("vnderror.json")); xmlReference = readFile(new ClassPathResource("vnderror.xml")); }