- 博客(20)
- 收藏
- 关注
原创 SpringBoot 静态资源与消息转换器
静态资源 默认路径 resources/public 或者 resources/static。可以修改:application.properties# 如果配置了全局静态资源路径,其余路径访问不到spring.resources.static-locations=classpath:/static/消息转换器TestController.java/** * SpringB...
2020-03-25 18:02:25 116
原创 SpringBoot 设置开发模式
pom.xml<!--设置为开发模式--><dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId></dependency><dependency> <...
2020-03-25 14:51:03 446
原创 SpringBoot log4j 配置使用
TestController.java@Controllerpublic class TestController { private static Logger logger = Logger.getLogger(TestController.class); @RequestMapping("/tests") @ResponseBody public St...
2020-03-25 14:42:24 547
原创 Spring 注解 配置 bean
beans-annotation.xml<!-- 指定spring ioc 容器扫描的包 --><!-- resource-pattern="repository/*.class" 指定 只扫描repository 包下的类 --><context:component-scan base-package="demo.annotatiton" resource-p...
2020-03-23 17:42:59 188
原创 SpringBoot 测试类的写法
SpringController.java@RestController // 如果每个功能返回的都是 Restful内容,那么可以使用该注解public class SpringController { @RequestMapping("/hello") public String yes() { return "hello"; }}TestS...
2020-03-23 14:49:53 1869
原创 SpringBoot 注解
@EnableAutoConfiguration@ComponentScan(“demo.controller”)@SpringBootApplication(scanBasePackages = {“demo.controller”}) // 组合注解//@EnableAutoConfiguration//@ComponentScan("demo.controller")// 上面...
2020-03-23 14:27:19 86
原创 Spring aop的通知 配置xml的方式
applicationContext.xml<!-- 配置切面的bean --><bean id="loggingAspect" class="demo.aop.LoggingAspect"></bean><!-- 配置 aop --><aop:config> <!-- 配置切点表达式 --> <...
2020-03-18 18:34:38 80
原创 Spring 配置事务管理器-xml的方式
applicationContext,xml<!-- 导入资源文件 --><context:property-placeholder location="classpath:db.properties"/><!-- 配置 C3P0 数据源 --><bean id="dataSource" class="com.mchange.v2.c3p0.Co...
2020-03-18 18:23:39 541
原创 Spring 配置事务管理器-注解的方式
applicationContext,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" xmlns:p=...
2020-03-17 11:40:11 398
原创 Spring中 JdbcTemplate
db.propertiesjdbc.user=root jdbc.password=root jdbc.driverClass=com.mysql.jdbc.Driver jdbc.jdbcUrl=jdbc:mysql:///spring jdbc.initPoolSize=5 jdbc.maxPoolSize=10 user 和 password 分别表示 my...
2020-03-17 11:01:46 208
原创 Spring aop的通知 配置bean的方式
前置通知。后置通知,出现异常也执行。返回通知,出现异常不执行。异常通知。环绕通知。配置bean的方式举例子: 只写切面日志类,前置 + 后置通知。需要两个注解:import org.aspectj.lang.annotation.Aspect;import org.springframework.stereotype.Component;@Aspect@Component...
2020-03-16 18:39:43 266
原创 Spring 中 配置文件 加入 aspectj-autoproxy 项目报错
没问题的项目<context:component-scan base-package="demo.aop"></context:component-scan>配置文件加入 自动 匹配 属性以后:<context:component-scan base-package="demo.aop"></context:component-scan>...
2020-03-16 17:44:39 882
原创 vue + ts
Vue 引入 TypeScriptVue 在 官方文档中有一节简单的介绍了如何引入 TypeScript,可惜文档太过简单,真正投入生产还有许多的细节没有介绍。我们对此进行了一系列探索,最后我们的风格是这样的:import { Component, Prop, Vue, Watch } from 'vue-property-decorator'import { State, Action,...
2020-03-10 11:08:27 195
原创 Spring bean 的 生命周期
beans-cycle.xml配置<bean id="car" class="demo.cycle.Car" init-method="init" destroy-method="destory"> <property name="brand" value="Audi"></property></bean><!-- 实现 Bea...
2020-03-10 10:56:07 98
原创 Spring中 使用util配置单例的集合bean,以供多个bean使用
配置单例的集合bean,以供多个bean使用,需要引入util命名空间<!-- 配置单例的集合bean,以供多个bean使用,需要引入util命名空间 --><util:list id="cars"> <ref bean="car"></ref> <ref bean="car2"></ref></u...
2020-03-06 15:17:17 270
原创 kafka 配置多台消费端,只有2个消费者可以消费
原因:查看 这个 topic 有几个 partition (分区),如果只有2个partition,那么就只有2他配置消费者的机器可以进行消费。
2020-03-06 15:10:49 3153
原创 Spring中配置bean属性注意事项
property 内部 ref, 内部bean<bean id="person" class="demo.beans.Person"> <property name="name" value="Tom"></property> <property name="age" value="24"></property> &...
2020-03-04 18:46:54 280
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人