
springboot
tensorhyt
这个作者很懒,什么都没留下…
展开
-
springboot-本地化(LOCAL)
1.编写本地化配置文件,格式:filename.properties:login.btn=登陆login.password=密码login.remember=记住我login.tip=请登陆login.username=用户名filename_en_US.properties:login.btn=Sign Inlogin.password=Passwordlogin.remember=Remember Melogin.tip=Please sign inlogin.usernam原创 2020-11-29 18:18:59 · 1563 阅读 · 0 评论 -
静态资源引用
当通过jar包将springboot项目封装成可执行文件时,静态资源文件有以下定位方式:1.引用jQuery、bootstrap等框架文件,可在webjars官网找到相应的依赖关系,复制到pom.xml中。 <dependency> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <vers原创 2020-11-18 16:54:02 · 586 阅读 · 0 评论 -
springboot学习(6)-日志配置
1.boot中通过slf4j+logback实现了日志的统一管理,目的可以规避掉多个项目中所使用日志框架不一致问题2.当引入新项目时需要在配置文件中将使用的日志框架剔除3.springboot日志框架调用参考: Logger logger= LoggerFactory.getLogger(getClass()); @Test void contextLoads() { l...原创 2020-01-12 21:59:48 · 695 阅读 · 0 评论 -
springboot学习(5)-自动配置原理理解
说明:理解自动配置原理可以更好的进行自动配置类参数的调整1.在springboot启动类中点击@SpringBootApplication查看注解信息,如下:@Target({ElementType.TYPE})@Retention(RetentionPolicy.RUNTIME)@Documented@Inherited@SpringBootConfiguration//启用自动配...原创 2020-01-11 20:53:22 · 368 阅读 · 0 评论 -
springboot学习(4)-批量激活不同运行环境参数,springboot配置文件加载顺序,springboot外部文件的加载顺序
可以通过一下两种方式来配置springboot不同运行环境下参数:方式1.application-{profile}.properties建立profile文件在其中配置相应的参数,结构如下:a. 参数配置参考如下:application-dev.properties#server.port=8083b. 在application.properties中激活参数:#server...原创 2020-01-11 15:37:34 · 193 阅读 · 0 评论 -
springboot学习(3)-配置文件的导入:PropertySource、ImportResource、Configuration
PropertySource:读取指定的配置文件,位置需要引用配置文件的地方,注意配合ConfigurationProperties进行内容的引用:@ConfigurationProperties(prefix ="person")@PropertySource(value = {"classpath:person.properties"})@Componentpublic class P...原创 2020-01-02 20:50:24 · 189 阅读 · 0 评论 -
springboot学习(2)-springinitializr,yml
使用springinitializr建立的项目结构如下:pname src main java resources static 保存静态资源例如:css,js,image, templates springboot默认使用内嵌tom...原创 2020-01-02 20:38:39 · 174 阅读 · 0 评论 -
springboot学习(1)-SpringBootApplication
@SpringBootApplication //springboot主程序@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME)@Documented@Inherited@SpringBootConfiguration@EnableAutoConfiguration@ComponentScan(exclude...原创 2019-12-19 20:55:30 · 144 阅读 · 0 评论