Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1 #12

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

1.1 #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions SpringBootDemo.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
7 changes: 6 additions & 1 deletion chapter1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -35,6 +35,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Empty file modified chapter11/.gitignore
100755 → 100644
Empty file.
Empty file modified chapter11/.mvn/wrapper/maven-wrapper.jar
100755 → 100644
Empty file.
Empty file modified chapter11/.mvn/wrapper/maven-wrapper.properties
100755 → 100644
Empty file.
154 changes: 0 additions & 154 deletions chapter11/E:\test\logback.log

This file was deleted.

Empty file modified chapter11/mvnw
100755 → 100644
Empty file.
Empty file modified chapter11/mvnw.cmd
100755 → 100644
Empty file.
128 changes: 84 additions & 44 deletions chapter11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.dudu</groupId>
<artifactId>demo</artifactId>
<artifactId>chapter11</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>demo</name>
<name>chapter11</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<version>2.4.0</version>
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<thymeleaf.version>3.0.7.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
<slf4j.version>1.7.21</slf4j.version>
<logback.version>1.1.7</logback.version>
</properties>

<dependencies>
Expand All @@ -41,7 +41,7 @@
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
<version>1.3.0</version>
</dependency>
<!--通用mapper-->
<dependency>
Expand All @@ -50,10 +50,15 @@
<version>1.1.5</version>
</dependency>
<!--pagehelper 分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
<version>1.2.5</version>
</dependency>


Expand Down Expand Up @@ -92,12 +97,47 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>

<!--部署外部tomcat容器的时候再开启-->
<!--<dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>-->
</dependency>
</dependencies>

<build>
Expand All @@ -108,41 +148,41 @@
</plugin>

<!--要打包了这个生成代码要禁止掉,本地开发开启-->
<!--<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
<dependencies>
&lt;!&ndash;配置这个依赖主要是为了等下在配置mybatis-generator.xml的时候可以不用配置classPathEntry这样的一个属性,避免代码的耦合度太高&ndash;&gt;
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<phase>package</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
&lt;!&ndash;允许移动生成的文件 &ndash;&gt;
<verbose>true</verbose>
&lt;!&ndash; 是否覆盖 &ndash;&gt;
<overwrite>true</overwrite>
&lt;!&ndash; 自动生成的配置 &ndash;&gt;
<configurationFile>src/main/resources/mybatis-generator.xml</configurationFile>
</configuration>
</plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.mybatis.generator</groupId>-->
<!-- <artifactId>mybatis-generator-maven-plugin</artifactId>-->
<!-- <version>1.3.5</version>-->
<!-- <configuration>-->
<!-- &lt;!&ndash;允许移动生成的文件&ndash;&gt;-->
<!-- <verbose>true</verbose>-->
<!-- &lt;!&ndash;是否覆盖&ndash;&gt;-->
<!-- <overwrite>true</overwrite>-->
<!-- &lt;!&ndash;自动生成的配置&ndash;&gt;-->
<!-- <configurationFile>src/main/resources/mybatis-generator.xml</configurationFile>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- &lt;!&ndash;配置这个依赖主要是为了等下在配置mybatis-generator.xml的时候可以不用配置classPathEntry这样的一个属性,避免代码的耦合度太高&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- <version>8.0.22</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>tk.mybatis</groupId>-->
<!-- <artifactId>mapper</artifactId>-->
<!-- <version>3.4.4</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>Generate MyBatis Artifacts</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>generate</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;
Expand All @@ -15,14 +15,14 @@
//启注解事务管理
@EnableTransactionManagement // 启注解事务管理,等同于xml配置方式的 <tx:annotation-driven />
@MapperScan(basePackages = "com.dudu.dao", markerInterface = MyMapper.class)
public class Application extends SpringBootServletInitializer {
public class Chapter11Application extends SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
return application.sources(Chapter11Application.class);
}

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(Chapter11Application.class, args);
}
}
Loading