Package: JavaFXSpringApplication
JavaFXSpringApplication
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JavaFXSpringApplication() |
|
|
|
|
|
||||||||||||||||||||
createApplicationContext() |
|
|
|
|
|
Coverage
1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * SteelBlue: DCI User Interfaces
5: * http://tidalwave.it/projects/steelblue
6: *
7: * Copyright (C) 2015 - 2025 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *************************************************************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/steelblue-src
22: * git clone https://github.com/tidalwave-it/steelblue-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.ui.javafx;
27:
28: import jakarta.annotation.Nonnull;
29: import java.util.ArrayList;
30: import java.util.Locale;
31: import org.springframework.context.ConfigurableApplicationContext;
32: import org.springframework.context.support.ClassPathXmlApplicationContext;
33: import it.tidalwave.ui.javafx.spi.AbstractJavaFXSpringApplication;
34: import org.slf4j.Logger;
35: import org.slf4j.LoggerFactory;
36:
37: /***************************************************************************************************************************************************************
38: *
39: * @author Fabrizio Giudici
40: *
41: **************************************************************************************************************************************************************/
42: public class JavaFXSpringApplication extends AbstractJavaFXSpringApplication
43: {
44: // Don't use Slf4j and its static logger - give Main a chance to initialize things
45: private final Logger log = LoggerFactory.getLogger(JavaFXSpringApplication.class);
46:
47: /***********************************************************************************************************************************************************
48: * Creates the application context.
49: *
50: * @return the application context
51: **********************************************************************************************************************************************************/
52: @Nonnull
53: protected ConfigurableApplicationContext createApplicationContext()
54: {
55: final var springConfigLocations = new ArrayList<String>();
56: final var osName = System.getProperty("os.name", "").toLowerCase(Locale.getDefault());
57: springConfigLocations.add("classpath*:/META-INF/*AutoBeans.xml");
58:
59:• if (osName.contains("os x"))
60: {
61: springConfigLocations.add("classpath*:/META-INF/*AutoMacOSXBeans.xml");
62: }
63:
64:• if (osName.contains("linux"))
65: {
66: springConfigLocations.add("classpath*:/META-INF/*AutoLinuxBeans.xml");
67: }
68:
69:• if (osName.contains("windows"))
70: {
71: springConfigLocations.add("classpath*:/META-INF/*AutoWindowsBeans.xml");
72: }
73:
74: log.info("Loading Spring configuration from {} ...", springConfigLocations);
75: return new ClassPathXmlApplicationContext(springConfigLocations.toArray(new String[0]));
76: }
77: }