Package org.springframework.boot.context
Class FileEncodingApplicationListener
java.lang.Object
org.springframework.boot.context.FileEncodingApplicationListener
- All Implemented Interfaces:
EventListener
,org.springframework.context.ApplicationListener<ApplicationEnvironmentPreparedEvent>
,org.springframework.core.Ordered
public class FileEncodingApplicationListener
extends Object
implements org.springframework.context.ApplicationListener<ApplicationEnvironmentPreparedEvent>, org.springframework.core.Ordered
An
ApplicationListener
that halts application startup if the system file
encoding does not match an expected value set in the environment. By default has no
effect, but if you set spring.mandatory_file_encoding
(or some camelCase or
UPPERCASE variant of that) to the name of a character encoding (e.g. "UTF-8") then this
initializer throws an exception when the file.encoding
System property does not
equal it.
The System property file.encoding
is normally set by the JVM in response to the
LANG
or LC_ALL
environment variables. It is used (along with other
platform-dependent variables keyed off those environment variables) to encode JVM
arguments as well as file names and paths. In most cases you can override the file
encoding System property on the command line (with standard JVM features), but also
consider setting the LANG
environment variable to an explicit
character-encoding value (e.g. "en_GB.UTF-8").
- Since:
- 1.0.0
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
FileEncodingApplicationListener
public FileEncodingApplicationListener()
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
onApplicationEvent
- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<ApplicationEnvironmentPreparedEvent>
-