@Value("#{build['version']}")
private String version;
<util:properties id="build" location="classpath:/META-INF/maven/de.einsundeins.hippo/mam-hippo-site/pom.properties" />
<util:properties id="build" location="classpath:META-INF/maven/de.einsundeins.hippo/mam-hippo-site/pom.properties" />
<util:properties id="build" location="/META-INF/maven/de.einsundeins.hippo/mam-hippo-site/pom.properties" />
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'build': Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [META-INF/maven/de.einsundeins.hippo/mam-hippo-site/pom.properties] cannot be opened because it does not exist
Hi Woonsan,
Hi Alex,
I’ve used the ServletContext.getResourceAsStream
in the past to display a build number in a webapp. I am not sure if Spring can read from the classpath inside a web container.
You can also try with the ClassLoader, but IIRC building the path can be tricky, it’s probably easier to use the ServletContext. So something like:
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("/META-INF\maven\de.einsundeins.hippo\mam-hippo-site");
--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("META-INF/maven/de.einsundeins.hippo/mam-hippo-site");
log.info(inputStream.toString());
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// InputStream input = classLoader.getResourceAsStream("META-INF/maven/de.einsundeins.hippo/mam-hippo-site");
System.out.println(classLoader.getResource("META-INF/MANIFEST.MF").toString());
InputStream input = classLoader.getResourceAsStream("META-INF/maven/de.einsundeins.hippo/mam-hippo-site");
log.info(input.toString());
--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unnamed bean
definition specifies neither 'class' nor 'parent' nor 'factory-bean' - can't generate bean name
<bean id="build"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location">
<bean class="">
<constructor-arg>
<bean
class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
<property name="targetObject" ref="componentManagerFacade" />
<property name="propertyPath" value="servletContext" />
</bean>
</constructor-arg>
<constructor-arg
value="/META-INF/maven/de.einsundeins.hippo/mam-hippo-site/pom.properties"
/>
</bean>
</property>
</bean>