当前位置: 首页 > news >正文

网站论坛 备案免费大数据网站

网站论坛 备案,免费大数据网站,佛山网站建设工作室,黄埔网站推广springboot整合javafx时候#xff0c;很多问题就在于controller没有被spring容器管理#xff0c;无法注入bean#xff0c;在这里提供一套自己的解决思路 执行逻辑 这里仅仅提供一个演示#xff0c;我点击按钮之后#xff0c;从service层返回一个文本并显示 项目结构 创…springboot整合javafx时候很多问题就在于controller没有被spring容器管理无法注入bean在这里提供一套自己的解决思路 执行逻辑 这里仅仅提供一个演示我点击按钮之后从service层返回一个文本并显示 项目结构 创建一个springboot项目 关键代码 springboot启动类中 FXApplication启动类中 全部代码 仅作示例自行修改   pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion3.4.0/versionrelativePath/ !-- lookup parent from repository --/parentgroupIdcom.shkj/groupIdartifactIdvideo-classification/artifactIdversion0.0.1-SNAPSHOT/versionnamevideo-classification/namedescriptionvideo-classification/descriptionurl/licenseslicense//licensesdevelopersdeveloper//developersscmconnection/developerConnection/tag/url//scmpropertiesjava.version17/java.versionjavafx.version21-ea24/javafx.versionmybatis-plus-boot-stater.version3.5.6/mybatis-plus-boot-stater.versionmysql-connector-java.varsion8.0.18/mysql-connector-java.varsiondruid.version1.1.23/druid.version/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependencydependencygroupIdorg.openjfx/groupIdartifactIdjavafx-base/artifactIdversion${javafx.version}/version/dependencydependencygroupIdorg.openjfx/groupIdartifactIdjavafx-controls/artifactIdversion${javafx.version}/version/dependencydependencygroupIdorg.openjfx/groupIdartifactIdjavafx-fxml/artifactIdversion${javafx.version}/version/dependencydependencygroupIdorg.openjfx/groupIdartifactIdjavafx-media/artifactIdversion${javafx.version}/version/dependencydependencygroupIdmysql/groupIdartifactIdmysql-connector-java/artifactIdversion${mysql-connector-java.varsion}/version/dependencydependencygroupIdcom.baomidou/groupIdartifactIdmybatis-plus-annotation/artifactIdversion${mybatis-plus-boot-stater.version}/version/dependencydependencygroupIdcom.baomidou/groupIdartifactIdmybatis-plus-boot-starter/artifactIdversion${mybatis-plus-boot-stater.version}/version/dependencydependencygroupIdcom.baomidou/groupIdartifactIdmybatis-plus-annotation/artifactIdversion${mybatis-plus-boot-stater.version}/version/dependencydependencygroupIdcom.alibaba/groupIdartifactIddruid/artifactIdversion${druid.version}/version/dependency/dependenciesbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/build/project VideoClassificationApplication package com.shkj.videoclassification;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext;SpringBootApplication(scanBasePackages com.shkj.videoclassification) public class VideoClassificationApplication {public static ConfigurableApplicationContext applicationContext;public static void main(String[] args) {applicationContextSpringApplication.run(VideoClassificationApplication.class, args);FXApplication.main(args);}} FXApplication package com.shkj.videoclassification;import com.shkj.videoclassification.controller.HelloController; import com.shkj.videoclassification.service.impl.TestServiceImpl; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.util.Callback; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;import java.io.IOException;/*** author shkj-大地* create 2024-12-13 21:41* description:*/ public class FXApplication extends Application {Overridepublic void start(Stage stage) throws IOException {FXMLLoader fxmlLoader new FXMLLoader(VideoClassificationApplication.class.getResource(/view/hello.fxml));// 注入fxmlLoader.setControllerFactory(VideoClassificationApplication.applicationContext::getBean);Scene scene new Scene(fxmlLoader.load());stage.setTitle(Hello!);stage.setScene(scene);stage.show();}public static void main(String[] args) {launch(args);}}application.yaml 这里也就是你自己平时用的连接数据库的配置还想看我的hello.fxml 一个简单的页面 ?xml version1.0 encodingUTF-8??import javafx.scene.control.Button? ?import javafx.scene.control.Label? ?import javafx.scene.layout.AnchorPane?AnchorPane prefHeight400.0 prefWidth600.0 xmlnshttp://javafx.com/javafx/23.0.1xmlns:fxhttp://javafx.com/fxml/1fx:controllercom.shkj.videoclassification.controller.HelloControllerchildrenButton onAction#onButtonClick layoutX210.0 layoutY272.0 mnemonicParsingfalseprefHeight63.0 prefWidth181.0 textButton /Label fx:idtextLabel layoutX181.0 layoutY83.0 prefHeight95.0 prefWidth239.0 textLabel //children /AnchorPane HelloController package com.shkj.videoclassification.controller;import com.shkj.videoclassification.service.TestService; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Label; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;/*** author shkj-大地* create 2024-12-13 21:36* description:*/ Component public class HelloController {Autowiredprivate TestService testService;FXMLpublic Label textLabel;FXMLpublic void onButtonClick(ActionEvent actionEvent) {String test testService.test();textLabel.setText(Hello World!test);} } TestServiceImpl package com.shkj.videoclassification.service.impl;import com.shkj.videoclassification.service.TestService; import org.springframework.stereotype.Service;/*** author shkj-大地* create 2024-12-13 21:45* description:*/ Service public class TestServiceImpl implements TestService {Overridepublic String test() {//你自己去写数据库查询语句吧//到这里了还用我教你return 我是service测试信息;} } TestService package com.shkj.videoclassification.service;/*** author shkj-大地* create 2024-12-13 21:44* description:*/ public interface TestService {String test(); }
http://www.hkea.cn/news/14575621/

相关文章:

  • 包头网站建设SEO优化制作设计公司万网没备案怎么做网站
  • 网站空间价格网站 开发 合同
  • 别人不能注册我的wordpress站app开发公司未按照合同开发
  • 专业做互联网招聘的网站有哪些内容网站建设教程 冰美人视频
  • 网站功能需求列表移动互联网的概念
  • php做网站都需要学什么网站设计公司种类
  • 企业网站 seo怎么做北京网络网站建设
  • 安化建设局网站廊坊建设局网站
  • 网站一定备案吗开发网站监控工具
  • 网站m3u8链接视频怎么做的东莞市建设监督网站
  • 东营做网站优化哪家好第四性 wordpress
  • 本科学院网站建设方案深圳企业黄页网
  • 太原企业网站建设全面的移动网站建设
  • 唐山网站建设400多少钱手机软件下载平台
  • 作品网站怎么自创网站
  • 可以做公司网站厦门开企网
  • 有哪里可以做兼职翻译的网站济南建设厅官方网站
  • 成都企业建站公司在线咨询wordpress无限绑域名
  • wordpress文章右边自定义字段wordpress插件dx seo
  • 餐饮公司做网站的好处北京百度推广公司
  • php网站 更改logo外贸退税流程及方法
  • 小辣椒网站开发互联网外包公司值得去吗
  • 运城住房和建设局网站网站开发销售话术
  • j网站开发的相关知识滨河网站建设
  • 做网站怎么买服务器吗直播发布会
  • 外包做的网站淄博seo开发
  • app推广平台网站seo公司是做什么的
  • 单位怎样做网站网站seo评测
  • 重庆专业网站推广上海工作室
  • 网站定位要点 有哪些方面优秀的网站建设