использовать java -classpath "full-path-of-folder-that-contains-resources" -jar jar-to-run.jar
пример: java -classpath C:\java\example -jar example.jar
EDIT: альтернативное решение
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:${config-location}/file_name.properties</value>
</list>
</property>
</bean>
и использовать java -Dconfig-location=absolute_path_to_config_folder -jar your.jar
Вы можете использовать prefetch_related
или select_related
в своем запросе:
posts = Post.objects.filter(user=some_user).prefetch_related(
'comment_set', 'comment_set__commentattachment_set'
)
Например, после выполнения запроса, как упомянуто, следующая команда может получить все комментарии для первого сообщения в набор запросов без выполнения запроса SQL:
posts.first().comment_set.all()