Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any syntax like : #{systemProperties['environment_variable_name']} to get the system variable?

Does using #{systemProperties['environment']} in the applicationcontext.xml file of Spring return the value associated with environment?

Or is there any way to ge the system variable value in the spring applicationcontext.xml file.

like image 693
Ritesh Mengji Avatar asked Jun 08 '11 22:06

Ritesh Mengji


People also ask

Is there a like in in SQL?

There is no combination of LIKE & IN in SQL, much less in TSQL (SQL Server) or PLSQL (Oracle). Part of the reason for that is because Full Text Search (FTS) is the recommended alternative.

What is like %% in SQL?

The LIKE operator is used in a WHERE clause to search for a specified pattern in a column. There are two wildcards often used in conjunction with the LIKE operator: The percent sign (%) represents zero, one, or multiple characters. The underscore sign (_) represents one, single character.

Can we use or operator in like?

You can use LIKE with OR operator which works same as IN operator.

Is there a NOT LIKE operator in SQL?

The NOT LIKE operator in SQL is used on a column which is of type varchar . Usually, it is used with % which is used to represent any string value, including the null character \0 . The string we pass on to this operator is not case-sensitive.


1 Answers

When I remember right, then there is a difference between:

You can access the system properties in different ways:

  • #{systemProperties['databaseName']}
  • #{systemProperties.databaseName}
  • ${databaseName} //$ instead of # !!

With #{systemProperties['databaseName']} you have access to system-system-properties.

With #{systemProperties.databaseName} you have access to the system properties readed for example from the command line (-DdatabaseName="testDB").

With ${databaseName} you have access the the properties from the properties files loaded and provided for example by the PropertyPlaceholderConfigurer and to the system prooperties too

@Value("#{systemProperties['java.version']}")
private String javaVersionMap;

//Dont know how
//@Value("#{systemProperties.javav.version}")
//private String javaVersionDirect;

@Value("${java.version}")
private String javaVersionProp;

//-DcmdParam=helloWorld
@Value("#{systemProperties['cmdParam']}")
private String cmdParamMap;

@Value("#{systemProperties.cmdParam}")
private String cmdParamDirect;

@Value("${cmdParam}")
private String cmdParamProp

You can use all of them in a @Value annotation or the config.xml files (<property name="databaseName" value="#{systemProperties.databaseName}"/>)

like image 179
Ralph Avatar answered Sep 23 '22 02:09

Ralph