Я использую среду выполнения Java V23, скомпилированную как исходный уровень Java 21 с JDK 23 и Spring Boot 3.4.0. Ведение журнала с помощью Logback. «application.properties» устанавливает «logging.level.root=TRACE»
При открытии проекта с помощью Intellij он говорит, что мои «основные» вызовы не выполняются. Хотя он запускается при вызове из консоли, как уже говорилось, просто
было предложено выполнить простую задачу. Создали один:
- Основной класс
import de.gombers.common.reflection.Tools;
@SpringBootApplication
@MapperScan(basePackages = "de.gombers.myhome.common.awattar.dbaccess, de.gombers.myhome.common.lng.dbaccess")
@ComponentScan({"de.gombers"})
публичный класс SampleGuiMain {}Код: Выделить всё
@SuppressWarnings("unused") private static final Logger LOGGER = LoggerFactory.getLogger(Tools.getClassName()); private static final String[] request = new String[] { "SampleGuiMainRunner" }; public static void main(String[] args) { ApplicationContext contexto = new SpringApplicationBuilder(SampleGuiMain.class) .web(WebApplicationType.NONE) .headless(false) .run(request); } - Класс выполнения команд
пакет de.gombers.myhome.mygui;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
импорт org.springframework.boot.CommandLineRunner;
импорт org.springframework.stereotype.Component;
импорт de.gombers.common.reflection.Tools;
@Component
публичный класс SampleMainGuiRunner реализует CommandLineRunner {}Код: Выделить всё
@SuppressWarnings("unused") private final static Logger LOGGER = LoggerFactory.getLogger(Tools.getClassName()); @Autowired private final SampleMainGuiFrame mainFrame; @Autowired public SampleMainGuiRunner(final SampleMainGuiFrame mainFrame) { this.mainFrame=mainFrame; } @Override public void run(String... args) throws Exception { if (!args[0].equals("SampleGuiMainRunner")) { LOGGER.debug("Nothing requested"); return; } try { mainFrame.process(); } catch (Exception e) { LOGGER.error("", e); } } - Swing JFrame добавляет JPane в TabbedPane
пакет de.gombers.myhome.mygui;
import java.awt.BorderLayout;
import java.util.concurrent.ExecutorService;
import javax.swing.JFrame;
импорт javax.swing.JTabbedPane;
импорт javax.swing.JTextField;
импорт javax.swing.WindowConstants;
импорт org.slf4j.Logger;
импорт org.slf4j.LoggerFactory;
импорт org.springframework.beans.factory.annotation.Autowired;
импорт org.springframework.stereotype.Component;
импорт de.gombers.common.properties.MyComponentListener;
импорт de.gombers.common.reflection.Tools;
импорт de.gombers.myhome.common.environment.GuiProperties;
import de.gombers.myhome.mygui.environment.MyHomeGuiProperties;
import de.gombers.myhome.mygui.lng.LngConsumptionPane;
@Component
публичный класс SampleMainGuiFrame расширяет JFrame{Код: Выделить всё
@SuppressWarnings("unused") private final static Logger LOGGER = LoggerFactory.getLogger(Tools.getClassName()); @Autowired private final SampleMainGuiPane myPane; private JTextField messageBox; protected final JTabbedPane tabbedPanes = new JTabbedPane(); @Autowired public SampleMainGuiFrame(final SampleMainGuiPane myPane) { super("MySample"); this.myPane=myPane; } public void process() { this.messageBox = new JTextField(); this.messageBox.setEditable(false); tabbedPanes.addTab("Sample", null, myPane, "my sample"); this.getContentPane().add(tabbedPanes, BorderLayout.CENTER); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); String panelId=this.getClass().getSimpleName(); this.setVisible(true); } - JPane выдает исключение по назначению
пакет de.gombers.myhome.mygui;
импорт java.awt.Color;
импорт java.text.DecimalFormat;
импорт java.util.List;
импорт javax.swing.JButton;
импортировать javax.swing.JLabel;
импортировать javax.swing.JPanel;
импортировать javax.swing.JTextField;
импортировать org.slf4j.Logger;
импортировать org.slf4j.LoggerFactory;
импортировать org.springframework.beans.factory.annotation.Autowired;
импорт org.springframework.stereotype.Component;
импорт com.brunchboy.util.swing.relativelayout.RelativeLayout;
импорт com.brunchboy.util.swing.relativelayout.RelativeLayoutHelper;
импорт de.gombers.common.reflection.Tools;
импорт de.gombers.myhome.common.dataprovider.lambda.COPLambdaCalculator;
импорт de.gombers.myhome.common.dataprovider.lambda.COPNibeCalculator;
импорт de.gombers.myhome.common.dataprovider.lambda.COPSuperCalculator;
импорт de.gombers.myhome.common.dataprovider.lambda.COPViessmanCalculator;
импорт de.gombers.myhome.common.environment.GuiProperties;
импорт de.gombers.myhome.lng.common.bindings.dto.AIOTEResultsMeterData;
import de.gombers.myhome.mygui.environment.MyHomeGuiProperties;
@Component
публичный класс SampleMainGuiPane расширяет JPanel {Код: Выделить всё
@SuppressWarnings("unused") private final static Logger LOGGER = LoggerFactory.getLogger(Tools.getClassName()); private int top=10, left=10; private int colWidth = 50; private final JTextField messageBox; @Autowired public SampleMainGuiPane() throws Exception { LOGGER.info("Have been invoked"); this.messageBox = new JTextField(); messageBox.setForeground(Color.BLACK); throw new Exception("by purpose thrown"); }
Подробнее здесь: https://stackoverflow.com/questions/798 ... -exception
Мобильная версия