严智鑫
2025-11-13 945bc394f40d8af1072a53da9a94f24207124e6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.northglass.listener;
 
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
 
public abstract class AbstractServerListener {
    
    protected static final int MESSAGE_LENGTH_START = 10;
    protected static final int MESSAGE_LENGTH_END = 13;
    
    protected static final int DATA_START = 74;
    
    /**
     * 信息头,字符串“<STA>”的16进制表示
     */
    protected static final String HEAD = "3c5354413e";
    
    /**
     * 信息尾,字符串“<EOF>”的16进制表示
     */
    protected static final String END = "3c454f463e";
    
    protected ApplicationContext initializeSpringContext() {
        GenericXmlApplicationContext context = new GenericXmlApplicationContext();
        context.getEnvironment().setActiveProfiles("production");
        context.load("applicationContext.xml");
        context.refresh();
        
        return context;
    }
}