最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Spring框架概述和翻轉(zhuǎn)權(quán)限控制方式

 更新時間:2025年08月16日 09:47:19   作者:LSL666_  
Spring是Java企業(yè)級開發(fā)的核心框架,通過IOC和AOP解耦對象依賴,統(tǒng)一生命周期管理,支持分層注解(@Service/@Repository等),覆蓋中大型項目全場景,成為標準化生態(tài)基石

1.1 Spring框架概述和翻轉(zhuǎn)權(quán)限控制

1.Spring框架是右邊框架的父框架。

Spring 并非簡單的 “父框架”,而是Java 生態(tài)中一站式企業(yè)級開發(fā)解決方案。它通過模塊化設(shè)計(Core、Context、AOP、TX 等模塊 ),為 Servlet 等框架提供底層支撐:

  • Servlet 專注于 “請求 - 響應(yīng)” 流程,但架構(gòu)復雜項目時(如分布式、高并發(fā)場景 ),需手動管理對象創(chuàng)建、依賴關(guān)系,開發(fā)效率低。
  • Spring 則通過 IOC(控制反轉(zhuǎn))、AOP(面向切面編程) 等核心機制,解決 “對象管理復雜”“功能擴展侵入性強” 等問題,覆蓋從小型項目到中大型系統(tǒng)的全場景開發(fā),而非局限于 “中大型項目”。

對比 Servlet 的核心優(yōu)勢

維度Servlet 開發(fā)痛點Spring 解決方案
對象管理需手動 new 對象,依賴關(guān)系混亂IOC 容器自動管理對象生命周期,依賴自動注入
功能擴展修改核心代碼實現(xiàn)擴展(如權(quán)限校驗)AOP 無侵入式增強,通過 “切面” 動態(tài)擴展功能
架構(gòu)復雜度應(yīng)對中大型項目需大量重復編碼(事務(wù)、日志)模塊化組件(@Service/@Repository 等)+ 生態(tài)整合(Spring Boot、Cloud )

2.Spring的核心功能:

傳統(tǒng)開發(fā)中,對象的創(chuàng)建(如 UserService userService = new UserService() )由開發(fā)者手動控制;

Spring 則通過 “控制反轉(zhuǎn)”,將對象創(chuàng)建、依賴裝配的權(quán)力轉(zhuǎn)移給框架。開發(fā)者只需定義 “需要什么對象”,由 Spring 自動完成 “創(chuàng)建 - 管理 - 注入” 全流程。

  • IOC是一個容器,Spring 啟動時,會掃描配置(注解 / XML ),將標記的類(如 @Component/<bean> )實例化為對象(Bean),并存儲在 IOC 容器 中,每次需要時只用從IOC里面獲取

核心價值

  • 解耦對象依賴:無需硬編碼 new 操作,通過 @Autowired 即可獲取容器中的 Bean。
  • 統(tǒng)一生命周期管理:Bean 的創(chuàng)建、初始化、銷毀由容器統(tǒng)一控制(如 init-method/@PostConstruct )。

3.Spring對bean的管理

Bean 是 Spring 對 “受管對象” 的抽象,即由 IOC 容器創(chuàng)建、管理、注入的對象。它可以是:

  • 業(yè)務(wù)邏輯類(@Service 標記的 UserService )
  • 數(shù)據(jù)訪問類(@Repository 標記的 UserDAO )
  • 工具類(@Component 標記的 CommonUtils )

Spring 提供分層語義注解,明確 Bean 的職責(替代通用 @Component ):

注解適用場景設(shè)計意圖
@Component普通工具類 / 通用組件基礎(chǔ)標記,無明確業(yè)務(wù)分層含義
@Controller表現(xiàn)層(Web 層)處理 HTTP 請求,封裝響應(yīng)邏輯
@Service業(yè)務(wù)層(Service 層)實現(xiàn)業(yè)務(wù)規(guī)則、協(xié)調(diào) DAO 與 Controller
@Repository持久層(DAO 層)封裝數(shù)據(jù)庫操作(MyBatis/ORM )

注入屬性指的是給屬性賦值。

基于xml注入屬性的方式有兩種,一種是通過get/set方法,一種是通過構(gòu)造器。

基于注解的方式注入屬性需要用到的注解

  • @Value 用于注入普通類型(String,int,double等類型)
  • @Autowired 默認按類型進行自動裝配(引用類型)
  • @Qualifier 不能單獨使用必須和@Autowired一起使用,強制使用名稱注入
  • @Resource Java提供的注解,也被支持。使用name屬性,按名稱注入

總結(jié):Spring 為何是 Java 開發(fā) “必修課”

  1. 生態(tài)基石:Spring 不僅是 “框架”,更是 Java 企業(yè)級開發(fā)的標準化生態(tài)(Spring Boot、Cloud、Security 等均基于其擴展 )。
  2. 解耦與效率:通過 IOC 實現(xiàn)對象解耦,AOP 實現(xiàn)功能無侵入增強,大幅降低中大型項目的維護成本。
  3. 語義化與規(guī)范:分層注解(@Controller/@Service )和注入機制,推動團隊代碼規(guī)范與架構(gòu)清晰。

掌握 Spring 核心機制(IOC/Bean 管理 ),是邁向 Java 中大型項目開發(fā)的關(guān)鍵一步 —— 它讓 “復雜系統(tǒng)開發(fā)” 從 “人力堆砌” 變?yōu)?“框架驅(qū)動”。

1.2 代碼

1.2.1 創(chuàng)建項目

新建一個Maven項目

什么都不選,直接下一步

創(chuàng)建完成,然后在pom.xml中導入相關(guān)依賴

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.qcby</groupId>
    <artifactId>Spring</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.12</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

1.2.2 創(chuàng)建對象

  • new創(chuàng)建對象和基于xml的方式創(chuàng)建對象
package com.qcby;

public class Demo {
    public void hello(){
        System.out.println("hello world");
    }
}
package com.qcby;

public class User {
    public void flay(){
        System.out.println("我會飛……");
    }
}

在resources文件里創(chuàng)建一個Spring.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- IOC管理對象的方式-->
    <!-- Spring基于xml的方式去創(chuàng)建對象-->
    <bean id="demo" class="com.qcby.Demo"/>
    <bean id="user" class="com.qcby.User"/>
</beans>
import com.config.SpringConfig;
import com.qcby.Cat;
import com.qcby.Demo;
import com.qcby.Dog;
import com.qcby.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

    /**
     *  傳統(tǒng)創(chuàng)建對象的方式
     *  人為手動創(chuàng)建,每次獲取對象需要new對象
     */
    @org.junit.Test
    public void run(){
        Demo demo = new Demo();
        demo.hello();
    }

    /**
     * IOC
     * 啟動Spring項目的時候,Spring創(chuàng)建的
     * 并且會將創(chuàng)建的對象放在一個IOC容器中,每次需要時只用從IOC里面獲取
     */
    @org.junit.Test
    public void run1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Demo demo = (Demo)context.getBean("demo");
        demo.hello();
    }

    @org.junit.Test
    public void run2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        User user = (User)context.getBean("user");
        user.flay();
    }
}
  • 基于注解的方式創(chuàng)建對象

Bean 名稱的默認生成規(guī)則:

當使用@Component、@Service、@Repository、@Controller等注解時,Spring 會自動生成 Bean 名稱。

規(guī)則: 將類名首字母小寫,例如類名UserService的默認 Bean 名稱為userService。

對于下面代碼使用的區(qū)別見后文。

package com.qcby;

import org.springframework.stereotype.Service;

@Service
public class Demo {
    public void hello(){
        System.out.println("hello world");
    }
}
package com.qcby;

import org.springframework.stereotype.Controller;

@Controller
public class User {
    public void flay(){
        System.out.println("我會飛……");
    }
}
package com.qcby;

import org.springframework.stereotype.Component;

@Component
public class Cat {
    public void run(){
        System.out.println("貓跑的很快……");
    }
}
package com.qcby;

import org.springframework.stereotype.Repository;

@Repository
public class Dog {
    public void jump(){
        System.out.println("狗跳的很高");
    }
}
import com.config.SpringConfig;
import com.qcby.Cat;
import com.qcby.Demo;
import com.qcby.Dog;
import com.qcby.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

    /**
     *  傳統(tǒng)創(chuàng)建對象的方式
     *  人為手動創(chuàng)建,每次獲取對象需要new對象
     */
    @org.junit.Test
    public void run(){
        Demo demo = new Demo();
        demo.hello();
    }

    /**
     * IOC
     * 啟動Spring項目的時候,Spring創(chuàng)建的
     * 并且會將創(chuàng)建的對象放在一個IOC容器中,每次需要時只用從IOC里面獲取
     */
    @org.junit.Test
    public void run1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Demo demo = (Demo)context.getBean("demo");
        demo.hello();
    }

    @org.junit.Test
    public void run2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        User user = (User)context.getBean("user");
        user.flay();
    }

    @org.junit.Test
    public void run3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Cat cat = (Cat)context.getBean("cat");
        cat.run();
    }

    @org.junit.Test
    public void run4(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Dog dog = (Dog)context.getBean("dog");
        dog.jump();
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- IOC管理對象的方式-->
    <!-- Spring基于xml的方式去創(chuàng)建對象-->
<!--    <bean id="demo" class="com.qcby.Demo"/>-->
<!--    <bean id="user" class="com.qcby.User"/>-->

    <!-- 掃描com.qcby下有哪些類,獲取全類名,方便創(chuàng)建對象-->
    <context:component-scan base-package="com.qcby"/>
</beans>

1.2.3 注入屬性

  • 基于xml的方式
package com.qcby;


public class Cat {
    //簡單類型
    private int age;
    private Integer num;
    private double height;
    private String name;
    private Demo demo;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Demo getDemo() {
        return demo;
    }

    public void setDemo(Demo demo) {
        this.demo = demo;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "age=" + age +
                ", num=" + num +
                ", height=" + height +
                ", name='" + name + '\'' +
                ", demo=" + demo +
                '}';
    }

    public void run(){
        System.out.println("貓跑的很快……");
    }
}
package com.qcby;


import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class Dog {
    //復雜類型
    private int[] arr;
    private List<String> list;
    private Map<String,String> map;

    public int[] getArr() {
        return arr;
    }

    public void setArr(int[] arr) {
        this.arr = arr;
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    public Map<String, String> getMap() {
        return map;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "arr=" + Arrays.toString(arr) +
                ", list=" + list +
                ", map=" + map +
                '}';
    }

    public void jump(){
        System.out.println("狗跳的很高");
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- IOC管理對象的方式-->
    <!-- Spring基于xml的方式去創(chuàng)建對象-->
    <bean id="demo" class="com.qcby.Demo"/>
<!--    <bean id="user" class="com.qcby.User"/>-->
    <!--通過get/set方法-->
    <bean id="cat" class="com.qcby.Cat">
        <!--property:完成屬性注入的標簽  name:要賦值的屬性名稱  value:要賦值的值  ref:用來做對象映射-->
        <property name="age" value="10"/>
        <property name="num" value="100"/>
        <property name="name" value="小白"/>
        <property name="height" value="10.27"/>
        <property name="demo" ref="demo"/><!-- 寫這行是要先把第9行寫上-->
    </bean>

    <bean id="dog" class="com.qcby.Dog">
        <property name="arr">
            <array>
                <value>11</value>
                <value>12</value>
                <value>100</value>
            </array>
        </property>
        <property name="list">
            <list>
                <value>熊大</value>
                <value>熊二</value>
            </list>
        </property>
        <property name="map">
            <map>
                <entry key="aaa" value="a"/>
                <entry key="bbb" value="b"/>
            </map>
        </property>
    </bean>

    <!--通過構(gòu)造器-->
    <bean id="user" class="com.qcby.User">
        <constructor-arg name="height" value="56.1"></constructor-arg>
        <constructor-arg name="name" value="小紅"></constructor-arg>
        <constructor-arg name="demo" ref="demo"></constructor-arg>
    </bean>
    

    <!-- 掃描com.qcby下有哪些類,獲取全類名,方便創(chuàng)建對象-->
<!--    <context:component-scan base-package="com.qcby"/>-->
</beans>
import com.config.SpringConfig;
import com.qcby.Cat;
import com.qcby.Demo;
import com.qcby.Dog;
import com.qcby.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class Test {

    /**
     *  傳統(tǒng)創(chuàng)建對象的方式
     *  人為手動創(chuàng)建,每次獲取對象需要new對象
     */
    @org.junit.Test
    public void run(){
        Demo demo = new Demo();
        demo.hello();
    }

    /**
     * IOC
     * 啟動Spring項目的時候,Spring創(chuàng)建的
     * 并且會將創(chuàng)建的對象放在一個IOC容器中,每次需要時只用從IOC里面獲取
     */
    @org.junit.Test
    public void run1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Demo demo = (Demo)context.getBean("demo");
        demo.hello();
    }

    @org.junit.Test
    public void run2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        User user = (User)context.getBean("user");
        user.flay();
        System.out.println(user);
    }

    @org.junit.Test
    public void run3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Cat cat = (Cat)context.getBean("cat");
        cat.run();
        System.out.println(cat);
    }

    @org.junit.Test
    public void run4(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Dog dog = (Dog)context.getBean("dog");
        dog.jump();
        System.out.println(dog);
    }
}
  • 基于注解的方式
package com.qcby;

import org.springframework.stereotype.Service;

@Service
public class Demo {
    public void hello(){
        System.out.println("hello world");
    }
}
package com.qcby;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class Cat {
    //簡單類型
    @Value(value="10")
    private int age;
    @Value(value="100")
    private Integer num;
    @Value(value="104.5")
    private double height;
    @Value(value="張三")
    private String name;
    @Autowired   //這個會自動映射
    private Demo demo;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Demo getDemo() {
        return demo;
    }

    public void setDemo(Demo demo) {
        this.demo = demo;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "age=" + age +
                ", num=" + num +
                ", height=" + height +
                ", name='" + name + '\'' +
                ", demo=" + demo +
                '}';
    }

    public void run(){
        System.out.println("貓跑的很快……");
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- IOC管理對象的方式-->
    <!-- Spring基于xml的方式去創(chuàng)建對象-->
<!--    <bean id="demo" class="com.qcby.Demo"/>-->
<!--    <bean id="user" class="com.qcby.User"/>-->
    <!--通過get/set方法-->
<!--    <bean id="cat" class="com.qcby.Cat">-->
<!--        <!&ndash;property:完成屬性注入的標簽  name:要賦值的屬性名稱  value:要賦值的值  ref:用來做對象映射&ndash;>-->
<!--        <property name="age" value="10"/>-->
<!--        <property name="num" value="100"/>-->
<!--        <property name="name" value="小白"/>-->
<!--        <property name="height" value="10.27"/>-->
<!--        <property name="demo" ref="demo"/><!&ndash; 寫這行是要先把第9行寫上&ndash;>-->
<!--    </bean>-->

<!--    <bean id="dog" class="com.qcby.Dog">-->
<!--        <property name="arr">-->
<!--            <array>-->
<!--                <value>11</value>-->
<!--                <value>12</value>-->
<!--                <value>100</value>-->
<!--            </array>-->
<!--        </property>-->
<!--        <property name="list">-->
<!--            <list>-->
<!--                <value>熊大</value>-->
<!--                <value>熊二</value>-->
<!--            </list>-->
<!--        </property>-->
<!--        <property name="map">-->
<!--            <map>-->
<!--                <entry key="aaa" value="a"/>-->
<!--                <entry key="bbb" value="b"/>-->
<!--            </map>-->
<!--        </property>-->
<!--    </bean>-->

<!--    <!&ndash;通過構(gòu)造器&ndash;>-->
<!--    <bean id="user" class="com.qcby.User">-->
<!--        <constructor-arg name="height" value="56.1"></constructor-arg>-->
<!--        <constructor-arg name="name" value="小紅"></constructor-arg>-->
<!--        <constructor-arg name="demo" ref="demo"></constructor-arg>-->
<!--    </bean>-->
    

    <!-- 掃描com.qcby下有哪些類,獲取全類名,方便創(chuàng)建對象-->
    <context:component-scan base-package="com.qcby"/>
</beans>
import com.config.SpringConfig;
import com.qcby.Cat;
import com.qcby.Demo;
import com.qcby.Dog;
import com.qcby.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {

    /**
     *  傳統(tǒng)創(chuàng)建對象的方式
     *  人為手動創(chuàng)建,每次獲取對象需要new對象
     */
    @org.junit.Test
    public void run(){
        Demo demo = new Demo();
        demo.hello();
    }

    /**
     * IOC
     * 啟動Spring項目的時候,Spring創(chuàng)建的
     * 并且會將創(chuàng)建的對象放在一個IOC容器中,每次需要時只用從IOC里面獲取
     */
    @org.junit.Test
    public void run1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Demo demo = (Demo)context.getBean("demo");
        demo.hello();
    }

    @org.junit.Test
    public void run2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        User user = (User)context.getBean("user");
        user.flay();
        System.out.println(user);
    }

    @org.junit.Test
    public void run3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Cat cat = (Cat)context.getBean("cat");
        cat.run();
        System.out.println(cat);
    }

    @org.junit.Test
    public void run4(){
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        Dog dog = (Dog)context.getBean("dog");
        dog.jump();
        System.out.println(dog);
    }
}

1.2.4 純注解開發(fā)

package com.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan(value = "com.qcby")
public class SpringConfig {

}

Test類中按這種方式寫

@org.junit.Test
public void run3(){
    ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
    Cat cat = (Cat)context.getBean("cat");
    cat.run();
    System.out.println(cat);
}

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • SpringBoot中的定時調(diào)度服務(wù)使用詳解

    SpringBoot中的定時調(diào)度服務(wù)使用詳解

    本文介紹了SpringBoot中定時任務(wù)的實踐應(yīng)用,包括pom包配置、啟動類啟用定時調(diào)度、創(chuàng)建定時任務(wù)、異步執(zhí)行定時任務(wù)、自定義任務(wù)線程池等內(nèi)容,SpringBoot內(nèi)置的@Scheduled注解可以滿足大部分業(yè)務(wù)需求
    2026-04-04
  • MybatisPlus整合Flowable出現(xiàn)的坑及解決

    MybatisPlus整合Flowable出現(xiàn)的坑及解決

    這篇文章主要介紹了MybatisPlus整合Flowable出現(xiàn)的坑及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • Java ThreadLocal有什么作用你知道嗎

    Java ThreadLocal有什么作用你知道嗎

    這篇文章主要為大家詳細介紹了java ThreadLocal的作用,具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助
    2021-09-09
  • Java設(shè)計模式之單態(tài)模式(Singleton模式)介紹

    Java設(shè)計模式之單態(tài)模式(Singleton模式)介紹

    這篇文章主要介紹了Java設(shè)計模式之單態(tài)模式(Singleton模式)介紹,本文講解了如何使用單例模式、使用單例模式注意事項等內(nèi)容,需要的朋友可以參考下
    2015-03-03
  • 分析Java中為什么String不可變

    分析Java中為什么String不可變

    Java中為什么String是不可變性的。今天我們從多角度解析為什么Java把String做成不可變的。
    2021-06-06
  • 冒泡排序算法原理及JAVA實現(xiàn)代碼

    冒泡排序算法原理及JAVA實現(xiàn)代碼

    關(guān)鍵字較小的記錄好比氣泡逐趟上浮,關(guān)鍵字較大的記錄好比石塊下沉,每趟有一塊最大的石塊沉底
    2014-01-01
  • java實現(xiàn)微信公眾平臺自定義菜單的創(chuàng)建示例

    java實現(xiàn)微信公眾平臺自定義菜單的創(chuàng)建示例

    這篇文章主要介紹了java實現(xiàn)微信公眾平臺自定義菜單的創(chuàng)建示例,需要的朋友可以參考下
    2014-04-04
  • SpringBoot多模塊掃描包問題及解決

    SpringBoot多模塊掃描包問題及解決

    解決多人協(xié)作Spring項目Bean注入問題:確保分包層級正確(Controller在webApplication下),使用@Component、@Service等注解,導入依賴并配置掃描,注意包名錯誤會導致掃描失敗
    2025-10-10
  • Java中計算集合中元素的出現(xiàn)次數(shù)統(tǒng)計

    Java中計算集合中元素的出現(xiàn)次數(shù)統(tǒng)計

    本文主要介紹了Java中計算集合中元素的出現(xiàn)次數(shù)統(tǒng)計,使用Collections類配合HashMap來統(tǒng)計和java lamb 計算這兩種方式,具有一定的參考價值,感興趣可以了解一下
    2024-02-02
  • Java經(jīng)典排序算法之快速排序代碼實例

    Java經(jīng)典排序算法之快速排序代碼實例

    這篇文章主要介紹了Java經(jīng)典排序算法之快速排序代碼實例,快速排序?qū)崿F(xiàn)的思想是指通過一趟排序?qū)⒁判虻臄?shù)據(jù)分割成獨立的兩部分,其中一部分的所有數(shù)據(jù)都比另外一部分的所有數(shù)據(jù)都要小,然后再按此方法對這兩部分數(shù)據(jù)分別進行快速排序,需要的朋友可以參考下
    2023-10-10

最新評論

武威市| 喀喇沁旗| 卫辉市| 同心县| 仙游县| 宁都县| 鄢陵县| 增城市| 招远市| 英山县| 浠水县| 葫芦岛市| 沛县| 密云县| 奉化市| 论坛| 武宁县| 特克斯县| 桐梓县| 永年县| 荆州市| 综艺| 高密市| 区。| 长泰县| 旬邑县| 巴林右旗| 阳信县| 泸溪县| 阿拉尔市| 石嘴山市| 聊城市| 库尔勒市| 嘉定区| 宁津县| 甘泉县| 清流县| 营山县| 黔西| 腾冲县| 武定县|