springboot学习
文章平均质量分 57
likeGhee
天人合一
展开
-
springboot1学习(九)项目打包
使用mvn package打包首先pom文件指定入口,mainClass标签改为自己的入口位置注意一下<version>1.3.3.RELEASE</version>版本号对应 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId>原创 2021-01-29 23:43:19 · 143 阅读 · 0 评论 -
springboot1学习(八)多环境配置、修改端口号、yml配置文件
多环境配置日常开发中,分为不同的环境配置文件,简单的可分为开发环境和上线环境,需要区分配置环境test—本地开发环境sit—测试环境prc—预生产环境prd—生产环境我们可以新建3个properties,分别对应不同的环境主配置文件application.properties不变,其中可以使用spring.profiles.active=选择哪个环境如spring.profiles.active=sit,表示加载application-sit.propertiesspring.profi原创 2021-01-29 23:07:02 · 2717 阅读 · 0 评论 -
springboot1学习(七)读取配置文件
项目中我们可以自定义配置信息例子,我可以在application.properties中加入自己的配置信息MY_CSDN_URL=https://blog.csdn.net/qq_19841133在想使用的地方加入引入@RestController@RequestMapping("/test1/UserController")public class User1Controller { @Value("${MY_CSDN_URL}") private String原创 2021-01-29 22:20:25 · 134 阅读 · 0 评论 -
springboot1学习(六)异步调用方法
什么是异步调用?类似于多线程运行代码。写个接口 @RequestMapping("/printMsg") public void printMsg(){ System.out.println("###############sendMsg1##################"); user1Service.printMsg(); System.out.println("###############sendMsg4###############原创 2021-01-29 22:10:09 · 167 阅读 · 0 评论 -
springboot1学习(五)创建定时任务
使用@Scheduled注解在Spring Boot的主类中加入@EnableScheduling注解,启用定时任务的配置新建schedule包,新建ScheduledTasks.javaimport org.springframework.scheduling.annotation.Scheduled;import org.springframework.stereotype.Component;import java.text.SimpleDateFormat;import java.ut原创 2021-01-29 21:53:32 · 114 阅读 · 0 评论 -
springboot1学习(四)整合log4j、AOP
很简单新建log4j.properties#log4j.rootLogger=CONSOLE,info,error,DEBUGlog4j.rootLogger=info,error,CONSOLE,DEBUGlog4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOL原创 2021-01-29 21:42:13 · 123 阅读 · 0 评论 -
springboot1学习(三)atomikos分布式事务
文章目录spring事务分类声明式事务atomikos分布式事务spring事务分类spring事务可分为编程式事务和声明式事务声明式事务又可分为xml版和注解版声明式事务写service层,注意添加 @Transactional注解import org.springframework.transaction.annotation.Transactional;@Servicepublic class User1Service { @Autowired private T原创 2021-01-29 17:15:17 · 285 阅读 · 0 评论 -
Springboot1学习(二)多数据源整合
文章目录@SpringBootApplication搭建多数据源项目思路分包结构整合多数据源实现@SpringBootApplication启动项目整合了常用的注解,也有扫包的作用,扫包的范围是当级包下,因此要注意启动类的位置。它整合了这三个注解@Configuration启动配置@EnableAutoConfiguration创建spring容器,自动加载@ComponentScan包扫描没有整合mybatis的扫包,所以@MapperScan(basePackages=)还是要的原创 2021-01-29 15:37:06 · 272 阅读 · 0 评论 -
Springboot1学习(一)快速入门
拖了好久,终于学开始springboot,馒馒来吧。看了看还有好多没学完…先学springboot1吧,磨刀不误砍柴功文章目录springboot概述快速入门第二种启动方式静态资源访问全局异常捕获FreeMarker页面渲染springboot概述支离破碎的语言随便写一下吧,反正都不看的。捂脸目前spingboot主流敏捷开发无需tomcat,内置了tomcat减少xml配置,改用propertiesspringcloud+springboot微服务技术springboot底层封原创 2021-01-28 22:18:06 · 406 阅读 · 2 评论
分享