《Spring Boot in Action》【6. Grails】

Spring Boot in Action A developer-focused guide to writing applications using Spring Boot. You'll learn how to bypass the tedious configuration steps so that you can concentrate on your application's behavior., Spring Boot in Action is a developer-focused guide to writing applications using Spring Boot. In it, you?ll learn how to bypass configuration steps so you can focus on your application?s behavior. Spring expert Craig Walls uses interesting and practical examples to teach you both how to use the default settings effectively and how to override and customize Spring Boot for your unique environment. Along the way, you?ll pick up insights from Craig?s years of Spring development experience. 立即下载

6. Grails

6.1 使用GORM持久化数据

GORM(Grails object-relational mapping)Book实体:

package readinglist

import grails.persistence.*

@Entity
class Book {
  Reader reader
  String isbn
  String title
  String author
  String description
}

要在Spring Boot项目中使用GORM,加入依赖:

compile("org.grails:gorm-hibernate4-spring-boot:1.1.0.RELEASE")

这是通过Hibernate,如果你使用MongoDB,也是可以的:

compile("org.grails:gorm-mongodb-spring-boot:1.1.0.RELEASE")

GORM Reader实体:

package readinglist
import grails.persistence.*

import org.springframework.security.core.GrantedAuthority
import org.springframework.security.core.authority.SimpleGrantedAuthority
import org.springframework.security.core.userdetails.UserDetails

@Entity
class Reader implements UserDetails {

  String username
  String fullname
  String password

  Collection<? extends GrantedAuthority> getAuthorities() {
    Arrays.asList(new SimpleGrantedAuthority("READER"))
  }

  boolean isAccountNonExpired() {
    true
  }

  boolean isAccountNonLocked() {
    true
  }

  boolean isCredentialsNonExpired() {
    true
  }

  boolean isEnabled() {
    true
  }
}

ReadingListController

package readinglist

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.ResponseStatus

@Controller
@RequestMapping("/")
@ConfigurationProperties("amazon")
class ReadingListController {

  @Autowired
  AmazonProperties amazonProperties

  @ExceptionHandler(value=RuntimeException.class)
  @ResponseStatus(value=HttpStatus.BANDWIDTH_LIMIT_EXCEEDED)
  def error() {
    "error"
  }

  @RequestMapping(method=RequestMethod.GET)
  def readersBooks(Reader reader, Model model) {
    List<Book> readingList = Book.findAllByReader(reader)
    model.addAttribute("reader", reader)
    if (readingList) {
      model.addAttribute("books", readingList)
      model.addAttribute("amazonID", amazonProperties.getAssociateId())
    }
    "readingList"
  }

  @RequestMapping(method=RequestMethod.POST)
  def addToReadingList(Reader reader, Book book) {
    Book.withTransaction {
      book.setReader(reader)
      book.save()
    }
    "redirect:/"
  }
}

Groovy SecurityConfig:

package readinglist

import org.springframework.context.annotation.Configuration
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
import org.springframework.security.core.userdetails.UserDetailsService

@Configuration
class SecurityConfig extends WebSecurityConfigurerAdapter {

  void configure(HttpSecurity http) throws Exception {
    http
      .authorizeRequests()
        .antMatchers("/").access("hasRole('READER')")
        .antMatchers("/**").permitAll()
      .and()
      .formLogin()
        .loginPage("/login")
        .failureUrl("/login?error=true")
  }

  void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth
      .userDetailsService(
        { username -> Reader.findByUsername(username) }
        as UserDetailsService)
  }
}

6.2 用GSP编写视图

目前为止我们都是使用Thymeleaf作为模板引擎,Grails项目同时提供了Groovy Server Pages(GSP)的自动配置,添加如下依赖:

compile("org.grails:grails-gsp-spring-boot:1.0.0")

接下来,把Thymeleaf readingList.html改写成readingList.gsp,同样是放在src/main/resources/templates路径下:

<!DOCTYPE html>
<html>
  <head>
    <title>Reading List</title>
    <link rel="stylesheet" href="/style.css"></link>
  </head>

  <body>
    <h2>Your Reading List</h2>

    <g:if test="${books}">
    <g:each in="${books}" var="book">
      <dl>
        <dt class="bookHeadline">
          ${book.title} by ${book.author}
          (ISBN: ${book.isbn}")
        </dt>
        <dd class="bookDescription">
          <g:if test="book.description">
            ${book.description}
          </g:if>
          <g:else>
            No description available
          </g:else>
        </dd>
      </dl>
    </g:each>
    </g:if>
    <g:else>
      <p>You have no books in your book list</p>
    </g:else>

    <hr/>

    <h3>Add a book</h3>

    <form method="POST">
      <label for="title">Title:</label>
      <input type="text" name="title" 
                         value="${book?.title}"/><br/>
      <label for="author">Author:</label>
      <input type="text" name="author"
                         value="${book?.author}"/><br/>
      <label for="isbn">ISBN:</label>
      <input type="text" name="isbn"
                         value="${book?.isbn}"/><br/>
      <label for="description">Description:</label><br/>
      <textarea name="description" rows="5" cols="80">
        ${book?.description}
      </textarea>
      <input type="hidden" name="${_csrf.parameterName}"
           value="${_csrf.token}" />
      <input type="submit" value="Add Book" />
    </form>

  </body>
</html>

需要注意的是,我们有一个隐藏域来放CSRF(Cross-Site Request Forgery)token,Spring Security要求在POST请求中有这个token,Thymeleaf会自动在渲染的HTML中加入这个token,但在GSP中,你得显式指定。

6.3 混合Spring Boot和Grails 3

Grails是一个建立在Spring,Groovy,Hibernate等之上的高层框架,目前,Grails 3建立在Spring Boot之上,所以对于Grails开发者和Spring Boot开发者来说,都有很好的开发体验。

在Mac OS X和大部分Unix系统上,安装Grails最方便的方法是使用SDKMAN:

$ sdk install grails

在Windows或者不能使用SDKMAN的系统上,你只好下载,解压并把bin目录添加到环境变量里去,检查安装是否成功:

$ grails -version

创建Grails项目

$ grails create-app readinglist

运行:

$ grails run-app

因为Grails 3的Gradle脚本使用了Spring Boot插件,所以也可以使用bootRun运行:

$ gradle bootRun

当然也可以打包运行:

$ gradle build
...
$ java -jar build/lib/readingList-0.1.jar

定义domain

$ grails create-domain-class Book

它会创建两个文件:Book.groovy和BookSpec.groovy,后面一个文件是测试Book类的Spock specification,初始是空的,Book.groovy在grails-app/domain/readingList目录下,像这样:

package readinglist

class Book {

  static constraints = {
  }
}

我们添加一些字段:

package readinglist

class Book {

  static constraints = {
  }

  String reader
  String isbn
  String title
  String author
  String description
}

静态变量constraints是用来定义验证约束的,这里我们不关心。

编写Grails控制器

有几种命令可以创建Controller:

  • create-controller——创建一个空的Controller
  • generate-controller——生成包含指定domain类型CRUD操作的骨架Controller
  • generate-all——生成包含指定domain类型CRUD操作的骨架Controller以及视图

我们使用第一个:

$ grails create-controller ReadingList

该命令会在grails-app/controllers/readingList目录下创建一个ReadingListController:

package readinglist

class ReadingListController {

  def index() { }
}

此时该控制器已经可以处理/readingList请求了,会返回grails-app/views/readingList/index.gsp视图(暂时还不存在)

package readinglist

import static org.springframework.http.HttpStatus.*
import grails.transaction.Transactional

class ReadingListController {

  def index() {
    respond Book.list(params), model:[book: new Book()]
  }

  @Transactional
  def save(Book book) {
    book.reader = 'Craig'
    book.save flush:true
    redirect(action: "index")
  }
}

接下来就是编写GSP页面,和6.2中的差不多:

<!DOCTYPE html>
<html>
  <head>
    <meta name="layout" content="main"/>
    <title>Reading List</title>
    <link rel="stylesheet"
          href="/assets/main.css?compile=false"  />
    <link rel="stylesheet"
          href="/assets/mobile.css?compile=false"  />
    <link rel="stylesheet"
          href="/assets/application.css?compile=false"  />
  </head>

  <body>
  <h2>Your Reading List</h2>

  <g:if test="${bookList && !bookList.isEmpty()}">
    <g:each in="${bookList}" var="book">
    <dl>
      <dt class="bookHeadline">
        ${book.title}</span> by ${book.author}
        (ISBN: ${book.isbn}")
      </dt>
      <dd class="bookDescription">
        <g:if test="${book.description}">
        ${book.description}
        </g:if>
        <g:else>
        No description available
        </g:else>
      </dd>
    </dl>
    </g:each>
  </g:if>
  <g:else>
    <p>You have no books in your book list</p>
  </g:else>

  <hr/>

  <h3>Add a book</h3>

  <g:form action="save">
  <fieldset class="form">
    <label for="title">Title:</label>
    <g:field type="text" name="title" value="${book?.title}"/><br/>
    <label for="author">Author:</label>
    <g:field type="text" name="author" value="${book?.author}"/><br/>
    <label for="isbn">ISBN:</label>
    <g:field type="text" name="isbn" value="${book?.isbn}"/><br/>
    <label for="description">Description:</label><br/>
    <g:textArea name="description" value="${book?.description}" rows="5" cols="80"/>
  </fieldset>
  <fieldset class="buttons">
    <g:submitButton name="create" class="save"
      value="${message(code: 'default.button.create.label', default: 'Create')}" />
  </fieldset>
  </g:form>

  </body>
</html>
Spring.Boot.in.Action.2015.12.pdf Spring.Boot.in.Action.2015.12.pdfFor online information and ordering of this and other manning books, please visit www.manning.com.thepublisheroffersdiscountsonthisbookwhenorderedinquantity For more information, please contact Special sales department Manning publications co 20 Baldwin Road PO BoX 761 Shelter island. ny11964 Emailorders@manning.com @2016 by manning Publications Co. All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted,in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and manning Publications was aware of a trademark claim, the designations have been printed in initial caps ll Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine Manning publications co Development editor: Cynthia Kane 20 Baldwin Road Technical development editor: Robert casazza PO BoX 761 Copyeditor: Andy Carroll Shelter island. ny11964 Proofreader: Corbin Collins Technical p der John Guthrie Typesetter: Gordan Salinovic Cover designer: Marija Tudor ISBN9781617292545 Printed in the united states of america 12345678910-EBM-201918171615 contents reword vii pre eface 2x about this book xii acknowledgments xu Bootstarting Spring I 1. 1 Spring rebooted Taking a fresh look at spring 2. Examining spring Boot essentials 4 What Spring Boot isn't 7 1.2 Getting started with Spring boot 8 Installing the spring boot cli 8 Initializing a spring boot project with Spring Initializr 12 3 Summary 22 Developing your first Spring Boot application 23 2.1 Putting spring boot to work 24 Examining a newly initialized spring boot project 26 Dissecting Bc iect build 30 2.2 USing starter dependencies 33 Specifying facet-based dependencies 34. Overriding starter transitive dependencies 35 CONTENTS 2.8 USing automatic configuration 37 Focusing on application functionality 37. Running the application 45. What just happened? 45 2.4 Summary 48 Customizing configuration 49 8.1 Overriding Spring Boot auto-configuration 50 Securing the application 50. Creating a custom security configuration 51. Taking another peek under the covers of auto-configuration55 8.2 Externalizing configuration with properties 57 Fine-tuning auto-configuration 58. Externally configuring application beans 64. Configuring with profiles 69 8.8 Customizing application error pages 71 3.4 Summary 74 Testing with Spring Boot 76 4.1 Integration testing auto-configuration 77 4.2 Testing web applications 79 Mocking spring MvC 80- Testing web security 83 4.3 Testing a running application 86 Starting the server on a random port 87. Testing HTML pages with selenium 88 4.4 Summary 90 Getting Groovy with the spring Boot CLI 92 5.1 Developing a Spring Boot CLI application 93 Setting up the cli project 93 Eliminating code noise with Groovy 94. What just happened? 98 5.2 Grabbing dependencies 100 Overriding default dependency versions 101. Adding dependency repositories 102 5.8 Running tests with the CLI 102 5.4 Creating a deployable artifact 105 5.5 Summary 106 CONTENTS 6 Applying Grails in Spring Boot 107 1 Using gorm for data persistence 108 2 Defining views with groovy server pages 113 6.3 Mixing spring boot with grails 3 115 Creating a new grails project 116 Defining the domain 118 Writing a grails controller 119. Creating the view 120 6.4 Summary 123 Taking a peek inside with the Actuator 124 7.1 Exploring the actuator's endpoints 125 Viewing configuration details 126. Tapping runtime metrics 133 Shutting down the application 139. Fetching application information 140 7.2 Connecting to the Actuator remote shell 141 Viewing the autoconfig report 142. Listing application beans 143 Watching application metrics 144.Invoking actuator endpoints 145 7. 3 Monitoring your application with JMX 146 7.4 Customizing the Actuator 148 Changing endpoint Ds 148 Enabling and disabling endpoints 149 Adding custom metrics and gauges 149- Creating a custom trace repository 153 Plugging in custom health indicators 155 7.5 Securing Actuator endpoints 156 7.6 Summary 159 8 Deploying Spring Boot applications 160 8.1 Weighing deployment options 161 8.2 Deploying to an application server 162 Building a WaRfile 162 Creating a production profile Enabling database migration 168 8.3 Pushing to the cloud 173 Deploying to Cloud Foundry 173 Deploying to Heroku 177 8. Summary 180 appendix a spring Boot developer Tools 187 appendix b spring Boot starters 188 appendix c Configuration properties 195 appendix d spring boot dependencies 232 index 243 In the spring of 2014, the Delivery Engineering team at Netflix set out to achieve a lofty goal: enable end-to-end global continuous delivery via a software platform that facilitates both extensibility and resiliency. my team had previously built two different applications attempting to address Netflix's delivery and deployment needs, but both were beginning to show the telltale signs of monolith-ness and neither met the goals of flexibility and resiliency. What's more, the most stymieing effect of these monolithic applications was ultimately that we were unable to keep pace with our partner's inno- vation. Users had begun to move around our tools rather than with them It became apparent that if we wanted to provide real value to the company and rap- idly innovate, we needed to break up the monoliths into small, independent services that could be released at will. Embracing a microservice architecture gave us hope that we could also address the twin goals of flexibility and resiliency. but we needed to do it on a credible foundation where we could count on real concurrency, legitimate moni- toring, reliable and easy service discovery, and great runtime performance With the jVM as our bedrock, we looked for a framework that would give us rapid velocity and steadfast operationalization out of the box. We zeroed in on Spring Boot Spring Boot makes it effortless to create Spring-powered, production-ready ser- vices without a lot of code! Indeed, the fact that a simple Spring Boot Hello World application can fit into a tweet is a radical departure from what the same functionality required on the vm only a few short years ago. Out-of-the-box nonfunctional features like security, metrics, health-checks, embedded servers, and externalized configura tion made boot an easy choice for us FOREWORD Yet, when we embarked on our Spring boot journey solid documentation was hard to come by. Relying on source code isnt the most joyful manner of figuring out how to properly leverage a frameworks features It's not surprising to see the author of mannings venerable Spring in Action take on the challenge of concisely distilling the core aspects of working with Spring Boot into another cogent book. Nor is it surprising that Craig and the Manning crew have done another tremendously wonderful job! Spring Boot in Action is an easily readable book, as weve now come to expect from Craig and manning From chapter Is attention-getting introduction to Boot and the now legend ary 9Oish-character tweetable Boot application to an in-depth analysis of Boots Actuator in chapter 7, which enables a host of auto-magical operational features required for any production application, Spring Boot in Action leaves no stone unturned. Indeed, for me, chapter 7's deep dive into the Actuator answered some of the lingering questions I've had in the back of my head since picking up Boot well over a year ago. Chapter 8s thor- ough examination of deployment options opened my eyes to the simplicity of cloud Foundry for cloud deployments. One of my favorite chapters is chapter 4, where Craig explores the many powerful options for easily testing a Boot application. From the get- o, I was pleasantly surprised with some of Springs testing features, and boot takes g advantage of them nicely As I've publicly stated before, Spring Boot is just the kind of framework the Java community has been seeking for over a decade. Its easy-to-use development features and out-of-the-box operationalization make java development fun again I,m pleased to report that Spring and spring boot are the foundation of Netflix's new continuous delivery platform. What's more, other teams at Netflix are following the same path because they too see the myriad benefits of boot It's with equal parts excitement and passion that I absolutely endorse craigs book as the easy-to-digest and fun-to-read Spring boot documentation the Java community has been waiting for since Boot took the community by storm. Craigs accessible writ- ing style and sweeping analysis of boot's core features and functionality will surely leave readers with a solid grasp of Boot(along with a joyful sense of awe for it) Keep up the great work Craig Manning Publications, and all the brilliant develop ers who have made spring boot what it is today each one of you has ensured a bright future for the JV ANDREW GLOVER MANAGER, DELIVERY ENGINEERING AT NETFLIX preface At the 1964 New York World's Fair, Walt Disney introduced three groundbreaking attractions:"“it' s a small world,”“ Great Moments with mr. Lincoln," and the“ Carouse of Progress " All three of these attractions have since moved into disneyland and walt Disney world, and you can still see them today My favorite of these is the Carousel of Progress. Supposedly, it was one of Walt Disneys favorites too. It's part ride and part stage show where the seating area rotates around a center area featuring four stages. Each stage tells the story of a family at different time periods of the 20th century-the early 1900s, the 1920s the 1940s, and recent times-highlighting the technology advances in that time period The story of innovation is told from a hand-cranked washing machine, to electric lighting and radio, to automatic dishwashers and television, to computers and voice-activated appliances In every act, the father (who is also the narrator of the show)talks about the latest inventions and says "It cant get any better only to discover that in fact, it does get better in the next act as technology progresses Although Spring doesn't have quite as long a history as that displayed in the Car- ousel of Progress, I feel the same way about Spring as"Progress Dad felt about the 20th century. Each and every Spring application seems to make the lives of developers so much better. Just looking at how Spring components are declared and wired together, we can see the following progression over the history of Spring 立即下载

相关推荐

grails-boot:Grails 与 Spring Boot 的集成

grails-boot Grails 与 Spring Boot 的集成 GORM Spring Boot 插件已移至

Groovy&Grails理解–第2部分

ils子 Grails是基于Groovy和Java的Web框架,可以将其部署到现有的Java Web服务器中,例如Tomcat或Jetty。 它的脚手架功能使您可以在几分钟内创建一个新项目。 Grails基于“基于配置的约定”的思想,该思想允许应用程序根据命名方案(而不是使用配置文件,例如XML文件)自动连接自身。 Grails框架无需任何配置即可进行实例开发。 Grails通过在开发过...

402

YOLOv8的Anchor-Free革新:从中心点预测到动态IoU匹配的全面解析

本文深入解析了YOLOv8采用Anchor-Free(无锚框)设计的核心优势与实现机制。通过摒弃预设锚框,模型直接预测目标中心点与宽高,结合解耦头、动态IoU匹配及Varifocal Loss等创新,显著简化了训练流程并提升了检测精度,尤其在小目标检测和模型泛化能力上表现突出。

weixin_29094301的博客 366

grails springboot_Spring Boot 和 Grails 的不同点

最近花了些时间了解了一下 Spring Boot 这个新框架。这个框架提供了快速开发基于 Spring Framework 的应用的功能。同样,SpringSource 旗下还有另一个用于 Web 应用快速开发的框架,就是 Grails。初看来这两个框架有很多相似的地方,所以可以将这两个框架做一下对比。Spring Boot 强调自运行;Grails 应用则需要打包成 WAR 来运行当然 Grai...

weixin_42400619的博客 543

随机向量函数链神经网络(RVFLNN)简介——附测试代码

宽度学习(Broad Learning System)原理介绍:随机向量函数链神经网络(RVFLNN) 目录宽度学习(Broad Learning System)原理介绍:随机向量函数链神经网络(RVFLNN)结构分析和训练优化 函数链神经网络(Functional-link neural network,简称FLNN)的结构如下图。 和深度神经网络结构不同的是,FLNN相当于把隐层放到了输入层中,作为增强结点(Enhancement nodes)。也可以理解成FLNN在输入层就对输入向量进行了非线性变换

weixin_44517742的博客 1万+

Vue3项目实战:用vue-print-nb搞定多页表格打印(附样式不丢失解决方案)

本文详细介绍了在Vue3项目中,如何利用vue-print-nb插件解决Element Plus多页表格打印的样式丢失与分页错乱等核心难题。通过分离打印视图、编写专用CSS控制分页行为、以及深入理解浏览器打印原理,提供了一套从基础配置到高级技巧的完整企业级打印解决方案,确保打印输出专业可靠。

linux的博客 1242

SpringBoot in Action——初识SpringBoot

现在,我们里利用了整本书的篇幅来介绍Spring。尽管Spring带来的主要益处就是简化Java开发,但本章将会介绍Spring Boot如何让这项任务变得更简单。 Spring Boot在Spring之上,构建了全新的开发模式,移除了开发Spring应用中很多单调乏味的东西。 我们首先整体了解一下Spring Boot,看它是怎么简化Spring的。 Spring Boot简介 在Spring家...

No_Game_No_Life_的博客 1770

iOS面试题大全(附带答案)

C语言相关面试题 1.static有什么用途? 答案:在C语言中,static主要定义全局静态变量,定义局部静态变量,定义静态函数。 static 属于静态变量,使用它修饰的变量生命周期是整个源程序。 @1.在函数体内的 static 变量的作用范围为该函数体,该变量的内存只被分配一次,因此其值在下次调用时仍维持上次的值; @2.在模块内的 static 全局变量可以被模块内所有函数访问,但不能被模块外其它函数访问; @3.在模块内的 static 函数只被这一模块内的其它函数调用,这个函数的使用范围被限

IOSNF的博客 2435

Groovy in Action 开源项目指南

Groovy in Action 开源项目指南 1. 项目介绍 Groovy in Action 是一个旨在深入探索Groovy编程语言特性的开源项目。该项目基于GitHub,由Dierk King开发维护(GitHub仓库)。它不仅提供了一个学习Groovy语言高级功能的平台,而且还通过示例和实际应用来展示如何有效地将Groovy融入到日常开发中,适合希望深入理解和掌握Groovy语言的开发者。...

gitblog_00796的博客 458

CRaxsRat v7.4远程管理工具使用教程(附资源下载)

CRaxsRat是一款图形化界面友好、功能较全面的远程管理平台,主要用于对多台计算机的统一维护与管理。该工具适用于以下场景:内网远程运维教学演示环境局域网设备调试程序自动化控制测试支持多种加密通信方式优化了远程桌面传输稳定性增加了自定义脚本模块后台运行更稳定,占用资源更少。

lzj781210的博客 2159

OpenGL 进阶系列10 - 光线跟踪实现简介(Ray Tracing)

OpenGL 实现光线跟踪(Ray Tracing)是一个相对复杂但有趣的挑战,通常用于生成高度逼真的图像效果,如反射、折射、阴影等。OpenGL 本身并不是为光线跟踪设计的,但可以通过结合计算着色器和现代 OpenGL 功能实现光线跟踪。光线跟踪的基本思路是从相机(或视点)出发,发射光线并计算这些光线与场景中物体的交点。光线与场景中物体相交的计算。计算交点的光照(基于表面法线、光源位置、材质等)。反射和折射的处理(如果物体是透明或反射的)。

GPU全栈博主 1539

Lithe-IDEA:专为Spring Boot优化的轻量级开源Java IDE内核

Java IDE 是支撑企业级应用开发的核心工具,其性能与框架适配能力直接影响开发效率。传统基于 IntelliJ Platform 的 IDE 虽功能完备,但架构耦合高、内存开销大、启动缓慢,难以满足 Spring Boot 微服务高频迭代与资源敏感场景需求。Lithe-IDEA 以‘减法优先’理念重构内核,采用 Kotlin + Java 17 实现编辑器、项目模型与构建协调器,深度集成 Spring Boot 全栈生态(含 Lombok、MyBatis-Plus、Actuator),在保持语义感知与调

weixin_34326429的博客 452

罗克韦尔AB PLC_FactoryTalk无法登录的解决方法

罗克韦尔AB PLC_FactoryTalk无法登录的解决方法

Robot_PLC_HMI_Automation 3592

Maven镜像配置全解析:原理、国内镜像源对比与多环境实战指南

在Java项目构建中,依赖管理是核心环节,Maven作为主流构建工具,其仓库机制负责从远程服务器下载和管理项目所需的库文件。其工作原理是通过解析pom.xml文件中的依赖声明,从配置的仓库地址获取构件。为了提升下载速度与稳定性,特别是在网络环境复杂的情况下,**仓库镜像**技术应运而生,它通过在国内部署缓存节点,将远程仓库的请求重定向到本地或更近的服务器,从而显著加速依赖解析和下载过程,这对于提升研发效率和保障构建流程的可靠性具有重要价值。常见的应用场景包括个人开发环境配置、团队协作统一以及持续集成流水线的

weixin_30407613的博客 416

时间序列预测 — 预测数据集(负荷、风电、光伏、销量等)

GEFCom2014 “负荷预测数据”为竞赛的公共数据集,GEFCom2014 的负荷预测轨迹为概率负荷预测。

几度春风里的博客 2万+

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

探索Spring Boot in Action:一款高效的Java开发工具

探索Spring Boot in Action:一款高效的Java开发工具 是一个开源项目,旨在帮助开发者更快速、更高效地构建基于Spring Boot的应用程序。该项目由 Hanson Wang 提供,它不仅是一个代码库,还是一份详细的学习资源,涵盖了Spring Boot的核心概念和实践技巧。 技术分析 1. Spring Boot: Spring Boot是Spring框架的一个扩展,它简化...

gitblog_00034的博客 523

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

SpringBoot in Action——自定义配置

在传统的Spring配置的过程,就如同订比萨的时候自己指定全部的辅料。而Spring Boot自动配置就像是从菜单上选一份特色比萨,让Spring Boot处理各种细节比自己声明上下文里全部的Bean要容易很多。 幸运的是,Spring Boot自动配置非常灵活。就像比萨厨师可以不在你的比萨里放蘑菇,而是加墨西哥胡椒一样,Spring Boot能让你参与进来,影响自动配置的实施。 覆盖Spring...

No_Game_No_Life_的博客 805

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

[转]Grails和 Spring

转自:http://justjavac.iteye.com/blog/705558 这一节适合于高级用户, Spring 框架,和想通过 插件开发来配置Grails的开发人员。 14.1 Grails内部实现 实际上Grails是变相的 Spring MVC 应用. Spring MVC是Spring框架内置的 MVC web开发框架.虽然从易用性来说Spring M

百事乐 1881

《Spring Boot in Action》【2. 开发第一个应用】

2 开发第一个应用2.1 项目骨架从本章开始,我们要开发一个简单的reading-list应用,用来维护一个reading-list,包括录入书的信息,查看阅读列表,删除书等操作。技术上,Spring MVC处理Web请求,Thymeleaf作为模板引擎编写页面,Spring Data JPA操作数据库,使用内置H2数据库,用Gradle管理项目。使用Spring Initializer生成生成的项

极客神殿 909

《Spring Boot in Action》【1. 起步】

1 起步 Spring 1.0,改变了企业级Java应用开发。依赖注入和声明式事务。 Spring 2.0,自定义XML命名空间。 Spring 2.5,面向注解的依赖注入模型,@Component和@Autowired,以及Spring MVC编程模型。无需显式声明组件,无需继承一些基础控制器类。 Spring 3.0,全新的基于Java的配置方式,从Spring 3.1开始的@Enable打头的

极客神殿 2242

Spring-boot IN Action(1)

之前在写Spring入门的学习笔记,但是深深感受到单单是“硬学”,即便有穿插一些生动的小例子,还是远远不能用好Spring,更不用谈掌握其核心,深入理解它的思想了。不得不承认,项目是进步的原动力,很复杂的思想、理念,经历几个项目,相信大家都能用的很熟,也会有一定的理解了,辅之以一些参考文档,大神的思想解析,便能够做到游刃有余地利用Spring,而不是被Spring的各种配置,各种思想、各种模式搞得

积跬步,至千里 1434

Spring-Boot-与-Grails-3相结合可以完成什么?,kafka快速入门

$ gradle bootRun 你还可以构建项目,运行生成的可执行JAR文件: $ gradle build … $ java -jar build/lib/readingList-0.1.jar 当然,构建产生的WAR文件可以部署到你喜欢的各种Servlet 3.0容器里。 在开发早期就能运行应用程序,这一点十分方便,能帮你确认应用程序已正确初始化。但是这时应用程序还没做什么有意思的事情,在初始化后的项目上做什么完全取决于我们。接下来,开始定义领域模型吧。 二、定义领域模型 阅读列表应用程序里的核心领域

m0_64384350的博客 348

Grails和Spring Boot都是优秀的Java Web应用开发框架,它们各有特点,适用于不同的场景,因此很难简单地说哪个更好

我很高兴地宣布Grails 1.3的即时可用性!Grails发行版的追随者们会记得,Grails的上一个主要发行版(Grails 1.2是在12月份发布的)已经不长了,但是考虑到需要让开发人员掌握最新、最棒的Groovy版本,grails1.3可以被看作是groovy1.7发行版。Groovy团队为Groovy语言带来了各种优秀的新功能,比如无注释的内部/嵌套类、AST构建器和power asserts(我个人最喜欢的),所有这些功能现在都可以在Grails应用程序中使用。

[Blog][Domain] programb.blog.csdn.net 438

SpringMVC(五)图书管理系统登录|书籍展示功能,三层架构解析

本文介绍了基于SpringMVC的图书管理系统登录与列表展示功能实现,采用前后端分离架构。通过Ajax实现用户登录验证,后端使用@RestController和@RequestMapping处理请求,模拟用户名密码匹配逻辑;图书列表接口返回包含书籍信息的JSON数据,利用List<BookInfo>模拟数据,结合Lombok简化实体类编写。项目结构清晰,为后续集成MyBatis和数据库奠定基础。

Lbycomputer的博客 372
上一篇: 《Spring Boot in Action》【5. Groovy】
下一篇: 《Spring Boot in Action》【7. Actuator】
.NET跨平台
博客等级 码龄15年 6066粉丝 738原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值