随笔分类 -  java

摘要:配置环境 spring.profiles.active=dev 获取当前环境 方法一 通过@Value注解获取 @Value("${spring.profiles.active}") private String env; 方法二 在配置文件中通过environment判断 @Bean public 阅读全文
posted @ 2022-11-03 08:53 Bin_x 阅读(1572) 评论(0) 推荐(0) 编辑
摘要:引入依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version> </dependency> 配置 @Configura 阅读全文
posted @ 2022-11-03 08:52 Bin_x 阅读(17) 评论(0) 推荐(0) 编辑
摘要:安装 导入maven包 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> 配置 在任何一个类上使用@Enabl 阅读全文
posted @ 2022-11-03 08:50 Bin_x 阅读(39) 评论(0) 推荐(0) 编辑
摘要:引入依赖 <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api --> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>jun 阅读全文
posted @ 2022-11-03 08:49 Bin_x 阅读(31) 评论(0) 推荐(0) 编辑
摘要:Slf4J slf4j是一个日志标准。 slf4j-simple、logback都是slf4j的具体实现,log4j并不直接实现slf4j,但是有专门的一层桥接slf4j-log4j12来实现slf4j。 关键代码是: import org.slf4j.Logger; import org.slf4 阅读全文
posted @ 2022-11-03 08:47 Bin_x 阅读(44) 评论(0) 推荐(0) 编辑
摘要:dependency type jar 默认为 jar,即引入一个jar包 pom 将所有的jar包打包为一个pom,如果依赖了pom,就可以使用所有的jar包 scope import 只在内定义的中支持import这一scope。 在当前这个pom文件的内定义的会被替换成一些系列的。 这些dep 阅读全文
posted @ 2022-07-25 15:56 Bin_x 阅读(36) 评论(0) 推荐(0) 编辑
摘要:自动装配 @ComponentScan 用于配置Spring需要扫描的被组件注解注释的类所在的包。 @Component 用于标注一个普通的组件类,它没有明确的业务范围,只是通知Spring被此注解的类需要被纳入到Spring Bean容器中并进行管理。 @Autowired Autowired用于 阅读全文
posted @ 2022-07-17 22:05 Bin_x 阅读(378) 评论(0) 推荐(0) 编辑
摘要:依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> 配置 com/binx/security/c 阅读全文
posted @ 2021-12-26 23:22 Bin_x 阅读(30) 评论(0) 推荐(0) 编辑
摘要:依赖 查看代码 <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.3.4</version> </dependency> <!-- 阅读全文
posted @ 2021-12-26 23:12 Bin_x 阅读(29) 评论(0) 推荐(0) 编辑
摘要:目前SpringBoot提供的 spring-boot-starter-cache 默认支持EhCache 2.x Ehcache 3+,详细了解可访问https://www.ehcache.org 1. 添加依赖 <dependency> <groupId>org.springframework. 阅读全文
posted @ 2021-12-17 23:54 Bin_x 阅读(343) 评论(0) 推荐(0) 编辑
摘要:@Resource 和 @Autowired 一样,是用来实现依赖注入的。 声明一个接口 public interface UserService { void readyTest(String var); } 单个实现类 新建一个类,实现该接口 import org.springframework 阅读全文
posted @ 2021-10-25 14:37 Bin_x 阅读(97) 评论(0) 推荐(0) 编辑
摘要:@Autowired Autowired用于自动装配,对于接口的实现类,可以使用该注解,消除get和set方法。 声明一个接口 public interface UserService { void readyTest(String var); } 单个实现类 新建一个类,实现该接口 import 阅读全文
posted @ 2021-10-25 14:28 Bin_x 阅读(59) 评论(0) 推荐(0) 编辑
摘要:lib和resources文件分离,打包之后,我们得到了三个文件: -- lib resources *.jar 将这三个文件拷贝到发布目录 在目录下运行命令 java -jar -Dloader.path=.,resources,lib *.jar 启动spring boot自带的tomcat服务 阅读全文
posted @ 2021-09-29 16:13 Bin_x 阅读(2403) 评论(0) 推荐(0) 编辑
摘要:pom.xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <!--用于处理项目的依赖插件--> <artifactId>maven-dependency-plugin</artifactId> <ex 阅读全文
posted @ 2021-09-29 15:29 Bin_x 阅读(701) 评论(0) 推荐(0) 编辑
摘要:热部署成功之后,每次修改文件其实还是要等待几秒的,这个跟电脑的配置有关系,多刷新几次看看。 引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifact 阅读全文
posted @ 2021-09-29 11:30 Bin_x 阅读(46) 评论(0) 推荐(0) 编辑
摘要:验证IDEA版本号设置 配置打包方式,默认使用maven-jar-plugin插件打包 <properties> <!--源码语言级别--> <maven.compiler.source>1.8</maven.compiler.source> <!--编译目标语言级别--> <maven.compi 阅读全文
posted @ 2021-09-29 10:19 Bin_x 阅读(178) 评论(0) 推荐(0) 编辑
摘要:下载 https://www.oracle.com/java/technologies/downloads/ 安装 配置环境变量 系统变量 JAVA_HOME D:\Program Files\Java\jdk-17 path %JAVA_HOME%\bin %JAVA_HOME%\jre\bin 阅读全文
posted @ 2021-09-22 21:59 Bin_x 阅读(26) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示