Why am I receiving a Null Exception when using @Value Annotations?
<p>I switched from getting values by loading up the properties file and retrieve them to using @Value annotations. Right now I am able to print the values that I set. When I run my application I see the value, But when I open up localhost:8080 I receive a null exception.</p>

<p><strong>IndexController</strong></p>

<pre><code>@Controller
public class IndexController {
     @RequestMapping(value = "/", method = RequestMethod.GET)
     public ModelAndView getdata() throws IOException {
        AppPortList apL = new AppPortList();
        List&lt;AppPortModel&gt; apList = apL.getAppPortList();   
        Collections.sort(apList);

ModelAndView model = new ModelAndView("index");
    model.addObject("showap", apList);

    return model;
}
</code></pre>

<p><strong>Properties file</strong></p>

<pre><code>APP_SERVERS=Server1@!Server1212@!Server12daa21@!Server21334
APP_SERVER_List=1020@!3011@!8080@!2020
</code></pre>

<p>//much more servers than this.</p>

<p><strong>Class that is having errors</strong></p>

<pre><code>@Component
public class AppPortList {      

 @Value("#{'${APP_SERVERS}'.split('@!')}")
    private String[] apServerArray;
 @Value("#{'${APP_SERVER_List}'.split('@!')}")
    private String[] appServerPortsList;

@PostConstruct
public List&lt;AppPortModel&gt; getAppPortList() {
    try {
        System.out.println(apServerArray.length + "@@@@");
            for (int z = 0; z &lt; apServerArray.length; z++) {                
                String apServer = apServerArray[z];
                String[] portListArray=appServerPortsList;
}catch {//stuff}
</code></pre>

<p><strong>Console Output</strong></p>

<pre><code>16@@@@@
</code></pre>

<p>When I open local host I receive a null exception on Line 80. Which is my for Statement. "for (int z = 0; z &lt; apServerArray.length; z++)" is coming up null. </p>

<p><strong>Running local Host Error</strong></p>

<pre><code>  java.lang.NullPointerException: null
at com.spring.web.util.AppPortList.getAppPortList(AppPortList.java:82) ~[classes/:na]
    at com.spring.web.controller.IndexController.getdata(IndexController.java:61) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_91]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_91]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_91]
</code></pre>

<p><strong>Attempt 2</strong></p>

<p>So I commented my for statment out and used System.out.println(apServerArray + "@@@@");</p>

<p><strong>Output 2</strong></p>

<pre><code> [Ljava.lang.String;@328b8745@@@@@
</code></pre>

<p>and when I ran my localhost I get null. So why does my console reads it when I run it then when I open localhost it becomes null?</p>

<pre><code>  null@@@@@
</code></pre>