-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
419 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright 2009-2018 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.ibatis.submitted.map_class_name_conflict; | ||
|
||
public class Person { | ||
private Long id; | ||
private String firstName; | ||
private String lastName; | ||
|
||
public String getFirstName() { | ||
return firstName; | ||
} | ||
|
||
public void setFirstName(String firstName) { | ||
this.firstName = firstName; | ||
} | ||
|
||
public String getLastName() { | ||
return lastName; | ||
} | ||
|
||
public void setLastName(String lastName) { | ||
this.lastName = lastName; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright 2009-2018 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.ibatis.domain.misc; | ||
|
||
import org.apache.ibatis.domain.blog.Author; | ||
import org.apache.ibatis.reflection.MetaObject; | ||
import org.apache.ibatis.reflection.wrapper.ObjectWrapper; | ||
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory; | ||
|
||
public class CustomBeanWrapperFactory implements ObjectWrapperFactory { | ||
@Override | ||
public boolean hasWrapperFor(Object object) { | ||
return object instanceof Author; | ||
} | ||
|
||
@Override | ||
public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) { | ||
return new CustomBeanWrapper(metaObject, object); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.huifer.hystrix.controller; | ||
|
||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
/** | ||
* <p>Title : TimeoutController </p> | ||
* <p>Description : </p> | ||
* | ||
* @author huifer | ||
* @date 2019-05-30 | ||
*/ | ||
@RestControllerAdvice(assignableTypes = {MyHystrixController.class}) | ||
public class TimeoutController { | ||
|
||
|
||
@ExceptionHandler | ||
public void onTimeoutException(TimeoutException timeoutException, Writer writer) | ||
throws IOException { | ||
writer.write(s("")); | ||
|
||
} | ||
|
||
private String s(String mse) { | ||
return "error " + mse; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.huifer.feign.annotation; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.client.ClientHttpRequestInterceptor; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
|
||
/** | ||
* <p>Title : RibbonRestController </p> | ||
* <p>Description : </p> | ||
* | ||
* @author huifer | ||
* @date 2019-05-30 | ||
*/ | ||
@Configuration | ||
public class RibbonConfig { | ||
|
||
|
||
@Autowired | ||
@Qualifier(value = "ribbon") | ||
private RestTemplate restTemplate3; | ||
|
||
|
||
@Bean | ||
@Autowired | ||
@Qualifier(value = "ribbon") // 固定搜索范围 | ||
public RestTemplate restTemplate3() { | ||
return new RestTemplate(); | ||
} | ||
|
||
|
||
/** | ||
* 所有的restTemplate 都增加 | ||
*/ | ||
@Bean | ||
@Autowired | ||
public Object f(@Qualifier(value = "ribbon") Collection<RestTemplate> restTemplates, | ||
ClientHttpRequestInterceptor interceptor) { | ||
restTemplates.forEach( | ||
restTemplate -> { | ||
restTemplate.setInterceptors(Arrays.asList(interceptor)); | ||
} | ||
); | ||
return new Object(); | ||
} | ||
|
||
|
||
} |
119 changes: 119 additions & 0 deletions
119
docs/spring/csdcb70150-7c70-11ef-bd43-acde48001122.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package com.github.huifer.full.shiro.entity; | ||
|
||
import com.baomidou.mybatisplus.annotation.TableField; | ||
import com.baomidou.mybatisplus.annotation.Version; | ||
import java.util.Date; | ||
import com.baomidou.mybatisplus.extension.activerecord.Model; | ||
import java.io.Serializable; | ||
|
||
/** | ||
* 企业表(ShiroCompany)表实体类 | ||
* | ||
* @author huifer | ||
* @since 2021-04-18 10:08:17 | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class ShiroCompany extends Model<ShiroCompany> { | ||
|
||
private Integer id; | ||
//企业名称 | ||
private String name; | ||
//企业地址 | ||
private String address; | ||
|
||
private Date createTime; | ||
|
||
private Integer createUser; | ||
|
||
private Integer updateUser; | ||
|
||
private Date updateTime; | ||
|
||
@Version | ||
private Integer version; | ||
@TableField | ||
private Integer deleted; | ||
|
||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getAddress() { | ||
return address; | ||
} | ||
|
||
public void setAddress(String address) { | ||
this.address = address; | ||
} | ||
|
||
public Date getCreateTime() { | ||
return createTime; | ||
} | ||
|
||
public void setCreateTime(Date createTime) { | ||
this.createTime = createTime; | ||
} | ||
|
||
public Integer getCreateUser() { | ||
return createUser; | ||
} | ||
|
||
public void setCreateUser(Integer createUser) { | ||
this.createUser = createUser; | ||
} | ||
|
||
public Integer getUpdateUser() { | ||
return updateUser; | ||
} | ||
|
||
public void setUpdateUser(Integer updateUser) { | ||
this.updateUser = updateUser; | ||
} | ||
|
||
public Date getUpdateTime() { | ||
return updateTime; | ||
} | ||
|
||
public void setUpdateTime(Date updateTime) { | ||
this.updateTime = updateTime; | ||
} | ||
|
||
public Integer getVersion() { | ||
return version; | ||
} | ||
|
||
public void setVersion(Integer version) { | ||
this.version = version; | ||
} | ||
|
||
public Integer getDeleted() { | ||
return deleted; | ||
} | ||
|
||
public void setDeleted(Integer deleted) { | ||
this.deleted = deleted; | ||
} | ||
|
||
/** | ||
* 获取主键值 | ||
* | ||
* @return 主键值 | ||
*/ | ||
@Override | ||
protected Serializable pkVal() { | ||
return this.id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.huifer.design.factory.method; | ||
|
||
import com.huifer.design.factory.MengNiu; | ||
import com.huifer.design.factory.Milk; | ||
|
||
/** | ||
* <p>Title : MengNiuFactory </p> | ||
* <p>Description : 蒙牛的生产工厂 ,该工厂只生产蒙牛</p> | ||
* | ||
* @author huifer | ||
* @date 2019-05-15 | ||
*/ | ||
public class MengNiuFactory implements MethodFactory { | ||
|
||
@Override | ||
public Milk createMilk() { | ||
System.out.println("蒙牛材料清单 : 牛奶 100 克"); | ||
return new MengNiu(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.huifer.idgen.my.service.exmple; | ||
|
||
import com.huifer.idgen.my.service.GenIdService; | ||
import com.huifer.idgen.my.service.bean.Id; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
/** | ||
* @author: wang | ||
* @description: | ||
*/ | ||
@Slf4j | ||
public class SpringIdGenRun { | ||
|
||
public static void main(String[] args) { | ||
ApplicationContext context = new ClassPathXmlApplicationContext("spring-factory-beans.xml"); | ||
GenIdService idServiceFactory = | ||
(GenIdService) context.getBean("idServiceFactory"); | ||
for (int i = 0; i < 10; i++) { | ||
|
||
long l = idServiceFactory.genId(); | ||
Id id = idServiceFactory.expId(l); | ||
log.info("{}", id); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.huifer.mybatis.pojo; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* 描述: | ||
* 职员 | ||
* | ||
* @author huifer | ||
* @date 2019-02-24 | ||
*/ | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Employee { | ||
private Integer empNo; | ||
private String ename; | ||
private String job; | ||
private Double sal; | ||
} |
Oops, something went wrong.