在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ Java問答
冷咖啡 回答

DOMContentLoaded在HTML文檔加載完后就會(huì)觸發(fā),而load要在這之后等樣式、img之類的東西都加載完了才會(huì)被觸發(fā)。詳細(xì)的參考MDN吧。

離殤 回答

你讓我們做前端的怎么想?!嗯?!

旖襯 回答
<DIV class=xx_cont>([\S\s]+?)<\/DIV>
鹿惑 回答

以后你在使用origin的時(shí)候就是你指定的的遠(yuǎn)程倉(cāng)庫(kù) git@github.com:suiweinuv/demo1.git ,你也可以起個(gè)自己好記的名字。

遺莣 回答

獨(dú)立的pyqt模塊而已。具體可以看qt的文檔

擱淺 回答

你好有發(fā)現(xiàn)是什么原因么,我這邊也遇到這個(gè)問題了,服務(wù)端DOS窗口進(jìn)行CTRL+C操作后會(huì)立即處理請(qǐng)求,還沒找到原因

愛礙唉 回答

war包發(fā)布做不到。如果你經(jīng)常有這種需求的話,建議考慮微服務(wù)的發(fā)布方式

下墜 回答

你好,部分歷史信息中存在他們的對(duì)比描述
Spring Data JPA 之 getOne() 和 findOne() 的區(qū)別 簡(jiǎn)易版
spring-data-jpa中findOne與getOne的區(qū)別 詳細(xì)版

目前我在項(xiàng)目中用SpringBoot2.0與Java8時(shí),findOne其實(shí)已經(jīng)被修改了
現(xiàn)在findOne是將找到一個(gè)QueryByExampleExecutor接口中定義的方法,
最后通過接口SimpleJpaRepository的默認(rèn)實(shí)現(xiàn)來CrudRepository實(shí)現(xiàn)。
此方法是通過示例搜索查詢,不希望你將其作為替換。

實(shí)際上,具有相同行為的方法仍然存在于新API中,但方法名稱已更改。
它是從更名findOne()到findById()的CrudRepository接口:

Optional<T> findById(ID id); 

你可以通過findById(id).get()來獲取具象化對(duì)象。

通常,當(dāng)您按ID查找實(shí)體時(shí),如果未檢索到該實(shí)體,則要返回該實(shí)體或進(jìn)行特定處理。

這里有兩個(gè)經(jīng)典的用例。

1)假設(shè)如果找不到實(shí)體,則要拋出異常,否則要返回它。

你可以寫:

return repository.findById(id)
        .orElseThrow(() -> new NotFoundEntity(id));

2)假設(shè)您要根據(jù)是否找到實(shí)體來應(yīng)用不同的處理(無需拋出異常)。

你可以寫:

Optional<Foo> fooOptional = fooRepository.findById(id);
if (fooOptional.isPresent()){
    Foo foo = fooOptional.get();
   // processing with foo ...
}
else{
   // alternative processing....
}
還吻 回答

手寫語句+注解,mysql Innodb 自己會(huì)加行級(jí)鎖,保證下面的語句線程安全,當(dāng)然 前提是你的 id 有索引


@Modifying
@Query("update products sc set quantity = quantity -1 where sc.id = ?")
public void UpdateById(@Param(value = "ids") String id);
安于心 回答

報(bào)錯(cuò)原因是jdk10的rt.jar里面沒有javax.xml.bind.JAXBException這個(gè)類

瘋子范 回答

多臺(tái)機(jī)器才能failover吧,設(shè)想一下如果一臺(tái)機(jī)器磁盤滿了,重連多少次也是失敗啊

failover:(tcp://192.168.1.1:61616,tcp://192.168.1.2:61616)?initialReconnectDelay=100
胭脂淚 回答

google 了一晚上,終于找到了比較滿意的方法,下面是整個(gè)的 RedisCacheConfig 文件

@Configuration
public class RedisCacheConfig {

    @Bean
    public KeyGenerator simpleKeyGenerator() {
        return (o, method, objects) -> {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(o.getClass().getSimpleName());
            stringBuilder.append(".");
            stringBuilder.append(method.getName());
            stringBuilder.append("[");
            for (Object obj : objects) {
                stringBuilder.append(obj.toString());
            }
            stringBuilder.append("]");

            return stringBuilder.toString();
        };
    }

    @Bean
    public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) {
        return new RedisCacheManager(
            RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory),
            this.getRedisCacheConfigurationWithTtl(600), // 默認(rèn)策略,未配置的 key 會(huì)使用這個(gè)
            this.getRedisCacheConfigurationMap() // 指定 key 策略
        );
    }

    private Map<String, RedisCacheConfiguration> getRedisCacheConfigurationMap() {
        Map<String, RedisCacheConfiguration> redisCacheConfigurationMap = new HashMap<>();
        redisCacheConfigurationMap.put("UserInfoList", this.getRedisCacheConfigurationWithTtl(3000));
        redisCacheConfigurationMap.put("UserInfoListAnother", this.getRedisCacheConfigurationWithTtl(18000));

        return redisCacheConfigurationMap;
    }

    private RedisCacheConfiguration getRedisCacheConfigurationWithTtl(Integer seconds) {
        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
        ObjectMapper om = new ObjectMapper();
        om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
        om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
        jackson2JsonRedisSerializer.setObjectMapper(om);

        RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig();
        redisCacheConfiguration = redisCacheConfiguration.serializeValuesWith(
            RedisSerializationContext
                .SerializationPair
                .fromSerializer(jackson2JsonRedisSerializer)
        ).entryTtl(Duration.ofSeconds(seconds));

        return redisCacheConfiguration;
    }
}

要指定 key 的過期時(shí)間,只要在getRedisCacheConfigurationMap方法中添加就可以。
然后只需要 @Cacheable 就可以把數(shù)據(jù)存入 redis

    @Cacheable(value = "UserInfoList", keyGenerator = "simpleKeyGenerator") // 3000秒
    @Cacheable(value = "UserInfoListAnother", keyGenerator = "simpleKeyGenerator") // 18000秒
    @Cacheable(value = "DefaultKeyTest", keyGenerator = "simpleKeyGenerator") // 600秒,未指定的key,使用默認(rèn)策略
    
九年囚 回答

假設(shè)我要做幾道菜:

  1. 麻婆豆腐
  2. 素炒小青菜
  3. 西紅柿炒蛋

以前我的做法:
我要做麻婆豆腐,先洗豆腐,然后找到豆瓣醬,把豆瓣醬炸出香味,然后我想到還需要辣椒,我就去切辣椒,切完辣椒放進(jìn)去后,我發(fā)現(xiàn)還需要姜蒜,我去切了姜蒜,然后和燒好的豆瓣醬一起煎出香味,倒入豆腐翻兩圈開始燜。
燜好麻婆豆腐之后,我要素炒小青菜。
我立即去洗小青菜,然后燒好油后發(fā)現(xiàn)還少了姜蒜,我就去切姜蒜,一陣手忙腳亂,小青菜炒好了。
如此重復(fù)進(jìn)行炒西紅柿炒蛋。

有了SOA之后:
我先剁好一小碗姜末;
我先剁好一小碗蒜末;
先切好青菜
先找好豆瓣醬
先洗好豆腐
先切好西紅柿

然后,我想要什么服務(wù),直接取。(嗯,這里可能來說是一個(gè)人的SOA)
后來,我為了想提高效率,叫我老婆來一起幫忙準(zhǔn)備這些材料,后面,突然有10個(gè)朋友來我家,要做的菜式更多了,然后我叫幾個(gè)朋友一起幫準(zhǔn)備各種材料。

這里面的思想還可以發(fā)散。后面的不想說了。


我想了一下,再補(bǔ)充一下

對(duì)于第一種情況,假設(shè)我每種菜要做10份,那么再叫來9個(gè)人和我一起重復(fù)上面的事情(多個(gè)服務(wù)器部署同一套系統(tǒng))
而后面有了SOA,我每一個(gè)人就只關(guān)注自己的具體邏輯,比如切青菜的專門切青菜,洗青菜的專門洗青菜等等,對(duì)于廚師(用戶),想要做一份西紅柿炒蛋,那他就去拿西紅柿和打好的蛋就好了,如果想做個(gè)西紅柿燜大腸,那么他就取取切好的西紅柿和切好的大腸就好了,分工明確,各司其職。

大濕胸 回答

success沒有打印的話,那應(yīng)該請(qǐng)求沒有成功...
qq的接口可以直接用 ajax請(qǐng)求嗎?
我之前做微信端的開發(fā),獲取access_token時(shí),是在后臺(tái)用php 的curl模擬post請(qǐng)求的

近義詞 回答
parameterType 將會(huì)傳入這條語句的參數(shù)類的完全限定名或別名。這個(gè)屬性是可選的,因?yàn)?MyBatis 可以通過 TypeHandler 推斷出具體傳入語句的參數(shù),默認(rèn)值為 unset。

請(qǐng)多看看文檔

故林 回答

從你貼出來的數(shù)據(jù)分析,雖然EO都是100%并且一直在進(jìn)行full gc,但是整個(gè)程序在這段時(shí)間內(nèi)的內(nèi)存使用很穩(wěn)定,新對(duì)象的產(chǎn)生和回收速度相當(dāng),不會(huì)向年老代堆積,所以并不會(huì)發(fā)生OOM。

不過以上僅是猜測(cè),具體情況可能還需要結(jié)合程序和更多數(shù)據(jù)來分析。

孤星 回答

1.數(shù)據(jù)庫(kù)是一定是加密后的密碼,用戶在前臺(tái)輸入用戶名和密碼,后臺(tái)對(duì)他的密碼進(jìn)行加密,然后和數(shù)據(jù)庫(kù)中的密碼進(jìn)行比對(duì),也有一種是不通過后臺(tái),直接通過前臺(tái)的javascript去加密,然后把加密的密碼去數(shù)據(jù)庫(kù)去比對(duì)。
1.更改shiro安全管理配置

<!-- 定義Shiro安全管理配置 -->

<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">  

<!-- <property name="realm" ref="systemAuthorizingRealm" /> -->

    <property name="realm" ref="userRealm" />    
    <property name="sessionManager" ref="sessionManager" />  
    <property name="cacheManager" ref="shiroCacheManager" />  
</bean>  
  
<!-- 3.1 直接配置繼承了org.apache.shiro.realm.AuthorizingRealm的bean -->  
 <bean id="userRealm" class="com.thinkgem.jeesite.modules.sys.security.SystemAuthorizingRealm">   
    <!-- 配置密碼匹配器 -->   
   <property name="credentialsMatcher" ref="credentialsMatcher"/>     
</bean>  
  
 <!-- 憑證匹配器 -->  
<bean id="credentialsMatcher" class="com.thinkgem.jeesite.modules.sys.security.CustomCredentialsMatcher">  
</bean>   

<property name="realm" ref="systemAuthorizingRealm" /> ,Spring自動(dòng)注入。

2.自定義密碼驗(yàn)證

/**

  • Description: 告訴shiro如何驗(yàn)證加密密碼,通過SimpleCredentialsMatcher或HashedCredentialsMatcher
  • @Author: wjl
  • @Create Date: 2017-3-14

*/

public class CustomCredentialsMatcher extends SimpleCredentialsMatcher {

  
@Override   
public boolean doCredentialsMatch(AuthenticationToken authcToken, AuthenticationInfo info) {    
         
UsernamePasswordToken token = (UsernamePasswordToken) authcToken;   
Object accountCredentials = getCredentials(info);  

// String pwd =encrypt32(String.valueOf(token.getPassword()));//md5 32位加密

String pwdType =String.valueOf(token.getPassword());// 判斷一下密碼是否是用戶輸入的,還是JCIS傳過來的  
if(pwdType.length() == 32){  
return equals(pwdType, accountCredentials); //密碼長(zhǎng)度=32位,說明是md5加密過,是從xx傳進(jìn)來的 32位加密。  
}   
String pwdUser =encrypt32(String.valueOf(token.getPassword()));//不等于32 是用戶輸入的密碼。 如果用戶輸入的密碼長(zhǎng)度位32那么里面會(huì)有一個(gè)bug  
return equals(pwdUser, accountCredentials);  
//將密碼加密與系統(tǒng)加密后的密碼校驗(yàn),內(nèi)容一致就返回true,不一致就返回false   
//return super.doCredentialsMatch(token, info) ;  
}  
  

3.更改密碼驗(yàn)證,注釋掉自帶的。

/** 
 * 設(shè)定密碼校驗(yàn)的Hash算法與迭代次數(shù) 
 */  

// @PostConstruct
// public void initCredentialsMatcher() {
// HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(SystemService.HASH_ALGORITHM);
// matcher.setHashIterations(SystemService.HASH_INTERATIONS);
// setCredentialsMatcher(matcher);
// // setCredentialsMatcher(new CustomCredentialsMatcher());
// }

如果不注釋就是用這種方式也可以。

/**

 * 設(shè)定密碼校驗(yàn)的Hash算法與迭代次數(shù) 
 */  
@PostConstruct  
public void initCredentialsMatcher() {    
   setCredentialsMatcher(new CustomCredentialsMatcher());    
}  
臭榴蓮 回答
final Label label = new Label("start");
label.setStyle("-fx-text-fill:red;");
final MenuButton menuButton = new MenuButton("", label);