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

鍍金池/ 問答/ Java問答
抱緊我 回答
package com.elyong.noway;

/**
 * Created by ely ong on 2017/11/27.
 */
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SimpleGui3C implements ActionListener{
    JFrame frame;
    public static void main(String[] args){
        SimpleGui3C gui=new SimpleGui3C();
        gui.go();
    }
    public void go(){
        //你的這里沒有賦值
        frame=new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JButton button=new JButton("Change colors");
        button.addActionListener(this);
        MyDrawPanel drawPanel=new MyDrawPanel();
        frame.getContentPane().add(BorderLayout.SOUTH,button);
        frame.getContentPane().add(BorderLayout.CENTER,drawPanel);
        frame.setSize(300,300);
        frame.setVisible(true);
    }
    public void actionPerformed(ActionEvent event){
        frame.repaint();
    }
}
class MyDrawPanel extends JPanel{
    public void paintComponent(Graphics g){
        Graphics2D g2d=(Graphics2D) g;
        int red=(int)(Math.random()*255);
        int green=(int)(Math.random()*255);
        int blue=(int)(Math.random()*255);
        Color startColor=new Color(red,green,blue);
        red=(int)(Math.random()*255);
        green=(int)(Math.random()*255);
        blue=(int)(Math.random()*255);
        Color endColor=new Color(red,green,blue);
        GradientPaint gradient=new GradientPaint(70,70,startColor,150,150,endColor);
        g2d.setPaint(gradient);
        g2d.fillOval(70,70,100,100);
    }
}

有一定的區(qū)別,如果沒有特殊需求,也沒有用到new String("123") 的需求。

String str1="ABC"; 和String str2 = new String("ABC");

String str1="ABC" 可能創(chuàng)建一個(gè)對(duì)象或者不創(chuàng)建對(duì)象,如果"ABC"這個(gè)字符串在java String池里不存在,會(huì)在java String池創(chuàng)建這個(gè)一個(gè)String對(duì)象("ABC").如果已經(jīng)存在,str1直接reference to 這個(gè)String池里的對(duì)象。

String str2 = new String("ABC") 至少創(chuàng)建一個(gè)對(duì)象,也可能兩個(gè)。因?yàn)橛玫絥ew 關(guān)鍵字,會(huì)在heap創(chuàng)建一個(gè) str2 的String 對(duì)象,它的value 是 "ABC".同時(shí),如果"ABC"這個(gè)字符串在java String池里不存在,會(huì)在java String池創(chuàng)建這個(gè)一個(gè)String對(duì)象("ABC").

做不到 回答

匹配結(jié)果查看

正則如下【本人不會(huì)py,只能給正則了】:

([^()]+)\(([^()]*)\)

或者直接這樣也行,替換為空

影魅 回答
@Deprecated
/*     */   public static native Class<?> getCallerClass(int paramInt);

加上int型參數(shù),
沒用過這個(gè)方法,嘗試一下
0:返回sun.reflect.Reflection
1:返回當(dāng)前類的Class對(duì)象
2:返回調(diào)用該方法的Class對(duì)象

使勁操 回答

你這個(gè)是超時(shí)了,先ping一下服務(wù)器,確保能ping通,然后再看看服務(wù)器防火墻是不是沒有開放端口,定位出問題的點(diǎn)

溫衫 回答

session
在你用戶沒有訪問權(quán)限,然后重定向之前,這個(gè)時(shí)候你將當(dāng)前路徑存入session
在你登錄之后再取出session里面的路徑,重定向到該路徑即可

局外人 回答

使用這個(gè)chrome插件吧,Sourcegraph for GitHub 安裝完成之后就回出現(xiàn)這個(gè)按鈕
圖片描述
點(diǎn)擊就會(huì)調(diào)轉(zhuǎn)到 一個(gè)在線的IDE可以跳轉(zhuǎn)的
圖片描述

熊出沒 回答

new HashMap<>()的時(shí)候 entrySet就已經(jīng)不為null了 不知道是不是底層賦值的?

焚音 回答

public class test {
public static List> source;

public static void main(String[] args) {

source = new ArrayList<>();

List<String> a = new ArrayList<String>();
a.add("黑色");
a.add("白色");
List<String> b = new ArrayList<String>();
b.add("64G");
b.add("128G");
List<String> c = new ArrayList<String>();
c.add("中國(guó)聯(lián)通");
c.add("中國(guó)移動(dòng)");
source.add(a);
source.add(b);
source.add(c);
ArrayList<String> result = new ArrayList<>();
recursion(result, source.get(0), 0, "");
System.out.println(result);

}

public static void recursion(List<String> result, List<String> para, int num, String choose) {

for (int i = 0; i < para.size(); i++) {
    if (source.size() == num + 1) {
        result.add(choose + "/" + para.get(i));
    } else {
        recursion(result, source.get(num + 1), num + 1, choose + "/" + para.get(i));
    }
}

}
}

我不懂 回答

第一種方法

試過在module1-service中添加自定義datasource(只支持properties,Yml可能能實(shí)現(xiàn),但還不太會(huì)寫),可以實(shí)現(xiàn)(此種方式不清楚是否會(huì)影響原來(lái)spring datasource機(jī)制,對(duì)spring原理不熟)
代碼如下:

@Component
@ConfigurationProperties(prefix = "spring.datasource")
@PropertySource("classpath:service-jdbc.properties")
public class MyDataSourceProperties {
    private String url;
    ...
}
@EnableConfigurationProperties(MyDataSourceProperties.class)
public class MyDataSourceConfig {
    @Autowired
    private MyDataSourceProperties myDataSourceProperties;
    @Bean
    @Primary
    public DataSource dataSource() {
        return DataSourceBuilder.create(myDataSourceProperties.getClassLoader()).type(myDataSourceProperties.getType()).driverClassName(myDataSourceProperties.determineDriverClassName()).url(myDataSourceProperties.determineUrl()).username(myDataSourceProperties.determineUsername()).password(myDataSourceProperties.determinePassword()).build();
    }
}

完整代碼:https://gitee.com/soft_xiang/...

第二種方法

在module1-service中自定義properties bean(此種方法較好,推薦),代碼如下

@Configuration
public class ServiceConfig {
    @Bean
    public static PropertySourcesPlaceholderConfigurer properties() {
        PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
        YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
        yaml.setResources(new ClassPathResource("application-module1-service.yml"));
        configurer.setProperties(yaml.getObject());
        return configurer;
    }
}

由第二種用法引起的新的問題:

項(xiàng)目中如果存在多環(huán)境配置文件,如application-module1-service-dev.yml/application-module1-service-test.yml/application-module1-service/-release.yml時(shí),怎樣根據(jù)module1-web中配置的spring.profiles.active加載對(duì)應(yīng)的配置文件?
思路為在加載文件時(shí)使用SpringContextUtil獲取配置文件中的active,在properties()中根據(jù)active加載文件
代碼如下:

SpringContextUtil.java

@Order(Integer.MIN_VALUE)
@Component
public class SpringContextUtil implements ApplicationContextAware {

    private static ApplicationContext context = null;
    @Override
    public void setApplicationContext(ApplicationContext applicationContext)
            throws BeansException {
        this.context = applicationContext;
    }
    /// 獲取當(dāng)前環(huán)境
    public static String getActiveProfile() {
        return context.getEnvironment().getActiveProfiles()[0];
    }
    /// 獲取當(dāng)前環(huán)境
    public static String[] getActiveProfiles() {
        return context.getEnvironment().getActiveProfiles();
    }
}

ServiceConfig

    @Bean
    public static PropertySourcesPlaceholderConfigurer properties() {
        PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
        String path = "application-module1-service.yml";
        try {
            String profile = SpringContextUtil.getActiveProfile();
            if (StringUtils.isNotBlank(profile)) {
                path = "application-module1-service-" + profile + ".yml";
            }
        }catch (NullPointerException e){
            e.printStackTrace();
            System.out.println("SpringContextUtil...未加載...");
        }
        YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
        yaml.setResources(new ClassPathResource(path));//File引入
        configurer.setProperties(yaml.getObject());
        return configurer;
    }

完整代碼:https://gitee.com/soft_xiang/...

然而這里會(huì)有循環(huán)依賴問題
運(yùn)行代碼會(huì)有

SpringContextUtil...未加載...

沒有實(shí)現(xiàn)根據(jù)active加載對(duì)應(yīng)配置文件

背叛者 回答

String都標(biāo)紅了,估計(jì)你沒配置jdk吧
在File->Project Structure->Project配置一下jdk

風(fēng)畔 回答

那用戶信息是如何獲取的呢?

請(qǐng)求后端獲取的。

這個(gè)問題太泛,百度搜一下,有很多有價(jià)值的東西。

笨笨噠 回答

var obj = [

{
    "省會(huì)": "北京123",
    "金額": 29097061.66
},
{
    "省會(huì)": "廣州123",
    "金額": 19784491.69
},
{
    "省會(huì)": "杭州123",
    "金額": 14068375.59
},
{
    "省會(huì)": "南1京1",
    "金額": 13391405.93
},
{
    "省會(huì)": "香22港3",
    "金額": 11244012.29
},
{
    "省會(huì)": "香22港3",
    "金額": 11244012.29
},
{
    "省會(huì)": "香22港3",
    "金額": 11244012.29
}

] //此處是原始數(shù)據(jù)
var obj1 = [

{
    "省會(huì)": "北京123",
    "金額": 29097061.66
},
{
    "省會(huì)": "廣州123",
    "金額": 19784491.69
},
{
    "省會(huì)": "杭州123",
    "金額": 14068375.59
},
{
    "省會(huì)": "南1京1",
    "金額": 13391405.93
},
{
    "省會(huì)": "香22港3",
    "金額": 11244012.29
},
{
    "省會(huì)": "香22港3",
    "金額": 11244012.29
},
{
    "省會(huì)": "臺(tái)灣",
    "金額": 11244012.29
}

] //此處是取發(fā)生變化后的數(shù)據(jù)
for (var i = 0 ; i < obj.length; i++) {

            if (obj[i].金額 == obj1[i].金額 && obj1[i].省會(huì) == obj1[i].省會(huì)) {

            } else {
                obj[i].金額 = "此處填寫要替換成什么值";
                obj[i].省會(huì) = "此處填寫要替換成什么值";
            }
        }

//最后obj就是替換成功后的新對(duì)象數(shù)組

神曲 回答
  1. 直接調(diào)用,是不是在項(xiàng)目里得有調(diào)用的類.
  2. 別人寫多個(gè).java文件,你不能一個(gè)一個(gè)導(dǎo)入到工程內(nèi)把,jar包就是把一些.class文件打包了,這樣用著不是方便嗎?
解夏 回答

不是輸入模式下
:set highlight 設(shè)置語(yǔ)法高亮的.試試json能不能高亮