properties-file

Where does slf4j-jdk14 get logging configurations from?

守給你的承諾、 提交于 2020-05-16 05:53:42
问题 Where does slf4j-jdk14 get configurations from? I am using compile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.8.0-alpha2' and importing import org.slf4j.Logger; import org.slf4j.LoggerFactory; In my java file my code is as below: Logger logger=LoggerFactory.getLogger(AppTest.class); logger.info("This is my login!!"); I am getting logs genereated but dont know where it is taking properties from. I want to disable Info logs from my property file as well as put those logs to file. I

IntelliJ IDEA does not recognize properties file

牧云@^-^@ 提交于 2020-02-25 04:56:18
问题 IntelliJ IDEA does not recognize my property file as seen in the picture below. When I change the name to something other than "assetInformationFields" like "assetInformationField" it is recognized perfectly. I already tried to invalidate caches and restart. IntelliJ IDEA version: 2017.1.5 回答1: Please see File | Settings ( Preferences on Mac) | Editor | File Types , select the Text files and remove assetInformationFields.properties from there. Most likely it was added by accident from the

boolean values in Spring application.properties file?

☆樱花仙子☆ 提交于 2020-02-23 09:03:52
问题 Is it possible to have boolean values in Spring configuration file? I wrote the following field in my bean: @Value("${pdk.populatedemo}") private boolean populateDemo; but if causes the following exception: Could not autowire field: private boolean com.inthemoon.pdk.data.DatabaseService.populateDemo; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type [java.lang.String] to required type [boolean]; nested exception is java.lang

Spring @Value annotated method, use default value when properties not available

只愿长相守 提交于 2020-01-22 07:33:22
问题 Situation I am injecting properties from .properties file into fields annotated with @Value . However this properties present sensitive credentials, so I remove them from repository. I still want that in case someone wants to run project and doesnt have .properties file with credentials that default values will be set to fields. Problem Even if I set default values to field itself I get exception when .properties file is not present: org.springframework.beans.factory.BeanCreationException:

Spring .properties file: get element as an Array

耗尽温柔 提交于 2020-01-19 04:42:48
问题 I'm loading properties attributes from a .properties file using Spring as follows: file: elements.properties base.module.elementToSearch=1 base.module.elementToSearch=2 base.module.elementToSearch=3 base.module.elementToSearch=4 base.module.elementToSearch=5 base.module.elementToSearch=6 The spring xml file file: myapplication.xml <bean id="some" class="com.some.Class"> <property name="property" value="#{base.module.elementToSearch}" /> </bean> And my Class.java file: Class.java public void

SPRING MVC - Use an external file as @PropertySource

送分小仙女□ 提交于 2020-01-13 19:39:44
问题 I was wondering how to use an external file to load some properties for my app in different contexts.. I know I can pass a file in PropertySource annotation. The problem is the path of the file. I mean, it looks like it want a full path to the file, but different environments have different paths for Tomcat directory. My question is: Where is the correct directory to store this files (it must be outside to the app dir otherwise on every deploy it is deleted) and how I can link it in my

SPRING MVC - Use an external file as @PropertySource

杀马特。学长 韩版系。学妹 提交于 2020-01-13 19:39:08
问题 I was wondering how to use an external file to load some properties for my app in different contexts.. I know I can pass a file in PropertySource annotation. The problem is the path of the file. I mean, it looks like it want a full path to the file, but different environments have different paths for Tomcat directory. My question is: Where is the correct directory to store this files (it must be outside to the app dir otherwise on every deploy it is deleted) and how I can link it in my

How to show a property loaded from properties file in JSF page

五迷三道 提交于 2020-01-11 05:58:43
问题 Is it possible, in a JSF page, to show a property loaded from a project.properties file (for example the database name)? In project.properties : cfg.bd.dbname=midatabase-name In some jsf page some expression similar to this: <h:outputText value="#{cfg.bd.dbname}" /> Thanks! 回答1: You can (ab)use <f:loadBundle> for this. <f:loadBundle basename="project" var="project" /> ... <h:outputText value="#{project['cfg.bd.dbname']} /> I said abuse , because the <f:loadBundle> is initially intented to

ReloadableResourceBundleMessageSource vs ResourceBundleMessageSource - cache concept & other differences

只愿长相守 提交于 2020-01-04 11:03:01
问题 I am learning spring. I tried to under the use of ResourceBundleMessageSource and here is the example I tried. Main App public class MainApp { public static void main(String arg[]){ ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); String text = context.getMessage("s.wish", new Object[] {"saro", "stanes" }, Locale.ENGLISH); System.out.println("English... " + text); String text2 = context.getMessage("s.wish", new Object[] {"saro", "stanes" }, Locale.FRANCE); System

How to load datasource configuration from external file in grails 3.1.8?

一世执手 提交于 2020-01-04 04:34:15
问题 I am writing a grails 3.1.8 application. My datasource written in application.groovy file. I want to load datasource configuration like username,password,DB from an external file. Is there any way to do it in grails 3+ versions. Here is my datasource configuration in application.groovy:- hibernate { cache { queries = false use_second_level_cache = true use_query_cache = false region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' } } dataSource { pooled = true jmxExport =