问:
How can i drag and drop multiple widgets at the same time i can drag my labels but want to drag them at the same time
```<code>from tkinter import *

def vp_start_gui():
    root = Tk()
    top = Toplevel1 (root)

root.mainloop()

class Toplevel1:
    def __init__(self, top=None):

        top.geometry("300x300")
</code>```

I use all of your funtions they work great the way you had them but if I put it a class is doesent work well

if I select individually it jumps about half a screen
            def select_and_drag(widgets_list):
                """Drags all the widgets together
                in the given list with mouse point.

```<code>            Args:
            widgets_list (list, tuple): Takes list of widgets
                to be moved together."""

            def set_drag(evt):
                """Set iniitial points."""
                for w in widgets_list:
                    w._drag_x = evt.x
                    w._drag_y = evt.y

            def on_drag(evt):
                """Drags with mouse."""
                for w in widgets_list:
                    x = w.winfo_x() - w._drag_x + evt.x
                    y = w.winfo_y() - w._drag_y + evt.y
                    w.place(x=x, y=y)

            for wid in widgets_list:
                wid.bind("<Button-1>", set_drag, '+')
                wid.bind("<B1-Motion>", on_drag, '+')

        self.Label1_3 = Label(top)
        self.Label1_3.place(relx=0.687, rely=0.183, height=36, width=124)
        self.Label1_3.configure(text='''Height''', bg="brown")

        self.Label1 = Label(top, text="try")
        self.Label1.pack()

        select_and_drag((self.Label1_3, self.Label1))
        select_and_drag((self.Label1,))

    if __name__ == '__main__':
    vp_start_gui()
</code>```

答:
Yes, it is possible and you are almost there with your code. I just modified and improved your drag functionality, I made one function select_and_drag(widget_list) which takes a list of widgets and makes a set of them together, which means moving one widget will make all the widgets in that set move along.

Here is the function.

def select_and_drag(widgets_list):
    """Drags all the widgets together
    in the given list with mouse point.

    Args:
        widgets_list (list, tuple): Takes list of widgets
                to be moved together."""

    def set_drag(evt):
        """Set iniitial points."""
        for w in widgets_list:
            w._drag_x = evt.x
            w._drag_y = evt.y

    def on_drag(evt):
        """Drags with mouse."""
        for w in widgets_list:
            x = w.winfo_x() - w._drag_x + evt.x
            y = w.winfo_y() - w._drag_y + evt.y
            w.place(x=x, y=y)

    for wid in widgets_list:
        wid.bind("<Button-1>", set_drag, '+')
        wid.bind("<B1-Motion>", on_drag, '+')
```

<hr>

<p><em>How to use it?</em></p>

<p>More than one set can be created with different widgets from this function. You can get an idea from this <strong>example</strong> below, move each <strong><em>SET</em></strong> and see for yourself.</p>

<pre class="lang-py prettyprint-override"><code>from tkinter import *

root  = Tk()
root.geometry("600x350")

# SET 1
lbl1 = Label(root, text='SET1', fg='red')
lbl1.pack()
lbl2 = Label(root, text='SET1', fg='red')
lbl2.pack()

# Common for SET1 and SET3
lbl3 = Label(root, text='SET1 and SET3',
             bg='pink', fg='red')
lbl3.pack()

# SET2
lbl4 = Label(root, text='SET2', bg='lightblue')
lbl4.pack()
lbl5 = Label(root, text='SET2', bg='lightblue')
lbl5.pack()

# SET2
lbl6 = Label(root, text='SET3', bg='pink')
lbl6.pack()

# Make SETS.
select_and_drag((lbl1, lbl2, lbl3))
select_and_drag((lbl4, lbl5))
select_and_drag((lbl3, lbl6))

root.mainloop()
</code>```

Body:
from tkinter import *

def vp_start_gui():
    root = Tk()
    top = Toplevel1 (root)

root.mainloop()

class Toplevel1:
    def __init__(self, top=None):

        top.geometry("300x300")

I use all of your funtions they work great the way you had them but if I put it a class is doesent work well

if I select individually it jumps about half a screen
            def select_and_drag(widgets_list):
                """Drags all the widgets together
                in the given list with mouse point.

            Args:
            widgets_list (list, tuple): Takes list of widgets
                to be moved together."""

            def set_drag(evt):
                """Set iniitial points."""
                for w in widgets_list:
                    w._drag_x = evt.x
                    w._drag_y = evt.y

            def on_drag(evt):
                """Drags with mouse."""
                for w in widgets_list:
                    x = w.winfo_x() - w._drag_x + evt.x
                    y = w.winfo_y() - w._drag_y + evt.y
                    w.place(x=x, y=y)

            for wid in widgets_list:
                wid.bind("<Button-1>", set_drag, '+')
                wid.bind("<B1-Motion>", on_drag, '+')

        self.Label1_3 = Label(top)
        self.Label1_3.place(relx=0.687, rely=0.183, height=36, width=124)
        self.Label1_3.configure(text='''Height''', bg="brown")

        self.Label1 = Label(top, text="try")
        self.Label1.pack()

        select_and_drag((self.Label1_3, self.Label1))
        select_and_drag((self.Label1,))

    if __name__ == '__main__':
    vp_start_gui()

Body:
Yes, it is possible and you are almost there with your code. I just modified and improved your drag functionality, I made one function select_and_drag(widget_list) which takes a list of widgets and makes a set of them together, which means moving one widget will make all the widgets in that set move along.

Here is the function.

def select_and_drag(widgets_list):
    """Drags all the widgets together
    in the given list with mouse point.

    Args:
        widgets_list (list, tuple): Takes list of widgets
                to be moved together."""

    def set_drag(evt):
        """Set iniitial points."""
        for w in widgets_list:
            w._drag_x = evt.x
            w._drag_y = evt.y

    def on_drag(evt):
        """Drags with mouse."""
        for w in widgets_list:
            x = w.winfo_x() - w._drag_x + evt.x
            y = w.winfo_y() - w._drag_y + evt.y
            w.place(x=x, y=y)

    for wid in widgets_list:
        wid.bind("<Button-1>", set_drag, '+')
        wid.bind("<B1-Motion>", on_drag, '+')

How to use it?

More than one set can be created with different widgets from this function. You can get an idea from this example below, move each SET and see for yourself.

from tkinter import *

root  = Tk()
root.geometry("600x350")

# SET 1
lbl1 = Label(root, text='SET1', fg='red')
lbl1.pack()
lbl2 = Label(root, text='SET1', fg='red')
lbl2.pack()

# Common for SET1 and SET3
lbl3 = Label(root, text='SET1 and SET3',
             bg='pink', fg='red')
lbl3.pack()

# SET2
lbl4 = Label(root, text='SET2', bg='lightblue')
lbl4.pack()
lbl5 = Label(root, text='SET2', bg='lightblue')
lbl5.pack()

# SET2
lbl6 = Label(root, text='SET3', bg='pink')
lbl6.pack()

# Make SETS.
select_and_drag((lbl1, lbl2, lbl3))
select_and_drag((lbl4, lbl5))
select_and_drag((lbl3, lbl6))

root.mainloop()


来源: stackexchange

问:
How to set selectedIndex of select element using display text?
How to set selectedIndex of select element using display text as reference?

Example:

```<code><input id="AnimalToFind" type="text" />
<select id="Animals">
    <option value="0">Chicken</option>
    <option value="1">Crocodile</option>
    <option value="2">Monkey</option>
</select>
<input type="button" onclick="SelectAnimal()" />

<script type="text/javascript">
    function SelectAnimal()
    {
        //Set selected option of Animals based on AnimalToFind value...
    }
 </script>
</code>```

Is there any other way to do this without a loop? You know, I'm thinking of a built-in JavaScript code or something. Also, I don't use jQuery...

答:
Try this:</p>

```<code>function SelectAnimal()
{
    var animals = document.getElementById('Animals');
    var animalsToFind = document.getElementById('AnimalToFind');
    // get the options length
    var len = animals.options.length;
    for(i = 0; i < len; i++)
    {
      // check the current option's text if it's the same with the input box
      if (animals.options[i].innerHTML == animalsToFind.value)
      {
         animals.selectedIndex = i;
         break;
      }
    }
}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
How to set selectedIndex of select element using display text as reference?

Example:

<input id="AnimalToFind" type="text" />
<select id="Animals">
    <option value="0">Chicken</option>
    <option value="1">Crocodile</option>
    <option value="2">Monkey</option>
</select>
<input type="button" onclick="SelectAnimal()" />

Is there any other way to do this without a loop? You know, I'm thinking of a built-in JavaScript code or something. Also, I don't use jQuery...

Body:
Try this:

function SelectAnimal()
{
    var animals = document.getElementById('Animals');
    var animalsToFind = document.getElementById('AnimalToFind');
    // get the options length
    var len = animals.options.length;
    for(i = 0; i < len; i++)
    {
      // check the current option's text if it's the same with the input box
      if (animals.options[i].innerHTML == animalsToFind.value)
      {
         animals.selectedIndex = i;
         break;
      }
    }
}


问:
Assigning a type to shallow clone
Is it possible to assign a type (one of two in this case).

```<code> static shallowClone(obj: IComponentData | ITemplate): IComponentData | ITemplate {
    return JSON.parse(JSON.stringify(obj)) as IComponentData | ITemplate;
  }
</code>```

In the other document:

```<code> activeTemplate = new BehaviorSubject<ITemplate>(null);
 this.builderComponentsService.activeTemplate.next(UtilService.shallowClone(styleTemplate));
</code>```

I get the following error whenever I perform the following operation:

```<code>TS2345: Argument of type '{}' is not assignable to parameter of type 'IComponentData | ITemplate'.
</code>```

答:
```<code>static shallowClone(obj): IComponentData | ITemplate {
   return JSON.parse(JSON.stringify(obj));
}
</code>```

or

```<code>shallowClone= <T>(original: T): T => {
  return JSON.parse(JSON.stringify(original));
};
</code>```

or

```<code>static shallowClone<IComponentData | ITemplate>(obj: IComponentData | ITemplate): IComponentData | ITemplate{
      return JSON.parse(JSON.stringify(original));
    };
</code>```

or the best one will be, because it works for all types :-

```<code>static shallowClone<T>(obj: T): T{
          return JSON.parse(JSON.stringify(original));
        };
</code>```

ContentLicense: CC BY-SA 4.0

Title: Assigning a type to shallow clone

Body:
Is it possible to assign a type (one of two in this case).

 static shallowClone(obj: IComponentData | ITemplate): IComponentData | ITemplate {
    return JSON.parse(JSON.stringify(obj)) as IComponentData | ITemplate;
  }

In the other document:

 activeTemplate = new BehaviorSubject<ITemplate>(null);
 this.builderComponentsService.activeTemplate.next(UtilService.shallowClone(styleTemplate));

I get the following error whenever I perform the following operation:

TS2345: Argument of type '{}' is not assignable to parameter of type 'IComponentData | ITemplate'.

Body:
static shallowClone(obj): IComponentData | ITemplate {
   return JSON.parse(JSON.stringify(obj));
}

or

shallowClone= <T>(original: T): T => {
  return JSON.parse(JSON.stringify(original));
};

or

static shallowClone<IComponentData | ITemplate>(obj: IComponentData | ITemplate): IComponentData | ITemplate{
      return JSON.parse(JSON.stringify(original));
    };

or the best one will be, because it works for all types :-

static shallowClone<T>(obj: T): T{
          return JSON.parse(JSON.stringify(original));
        };


问:
How can I obtain class props from url and store in react-redux
so I am trying to pass params using route to a react component and also at the same time use Component class props. Here is what am doing

```<code>import { loadSchemes, } from '../../actions/schemes;

export class Schemes extends Component {
constructor(props) {
    super(props);
    const { match: { params } } = this.props;
    this.state = {
      client_id: params.pk,
    }
  }
componentDidMount() {
    this.props.loadSchemes();
  }
render(){
 return(
   <div>
    {this.props.schemes_list.map((scheme,index)=><p key={index}>{scheme}</p>)}
   </div>
  )
 }
}
const mapStateToProps = (state) => ({
  schemes_list: state.schemes,
});
export default connect(mapStateToProps,{ loadSchemes,})(Schemes);
</code>```

And I have a url to this component as

```<code><Route path="/client/:pk/schemes" component={Schemes}/>
</code>```

The problem is I get an error this.props.schemes_list is undefined and this.props.loadSchemes is undefined

please help am using react-redux

答: Obviousely in component from where you call Scheme, you import { Schemes }, an unconnected component, instead of Schemes - default connected component. Please check it.</p>

Body:
so I am trying to pass params using route to a react component and also at the same time use Component class props. Here is what am doing

import { loadSchemes, } from '../../actions/schemes;

export class Schemes extends Component {
constructor(props) {
    super(props);
    const { match: { params } } = this.props;
    this.state = {
      client_id: params.pk,
    }
  }
componentDidMount() {
    this.props.loadSchemes();
  }
render(){
 return(

    {this.props.schemes_list.map((scheme,index)=>
{scheme}
)}

  )
 }
}
const mapStateToProps = (state) => ({
  schemes_list: state.schemes,
});
export default connect(mapStateToProps,{ loadSchemes,})(Schemes);

And I have a url to this component as

<Route path="/client/:pk/schemes" component={Schemes}/>

The problem is I get an error this.props.schemes_list is undefined and this.props.loadSchemes is undefined

please help am using react-redux


问:
Has anyone run spark-submit recently?
I am getting the below error while running spark-submit. Any help is appreciated.

```<code>20/05/30 10:27:32 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Exception in thread "main" java.io.IOException: No FileSystem for scheme: C
        at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2660)
</code>```

THanks,
Nitin

答:
Try setting you file path

```<code>"file\\C:\path to the file\"
</code>```

instead of

```<code>"C:\path to the file\"
</code>```

Title: Has anyone run spark-submit recently?

Body:
I am getting the below error while running spark-submit. Any help is appreciated.

20/05/30 10:27:32 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Exception in thread "main" java.io.IOException: No FileSystem for scheme: C
        at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2660)

THanks,
Nitin

Body:
Try setting you file path

"file\\C:\path to the file\"

instead of

"C:\path to the file\"


问:
Error in Debug caused by creation of beans
I state that I am new on the forum and I am a beginner with Java, so I apologize in advance for any mistakes.

I'm working on a web application in Java, using Spring Boot, to utilize Google Drive API for list files on my Google Drive. I'm follow the courses on youtube from carbonrider, so the main and the controller are the same created from him, but in debug I receive an error about creating beans. I'll show you the code :

CollaborativeApplication.java

```<code>
package com.collaborative.gsuite.collaborativegsuite;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CollaborativeApplication {

    public static void main(String[] args) {
        SpringApplication.run(CollaborativeApplication.class, args);
    }

}

</code>```

HomePageController.java

```<code>

package com.collaborative.gsuite.collaborativegsuite.controller;

import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.drive.DriveScopes;

@Controller
public class HomepageController {

    private static HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
    private static JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();

    // private static final List<String> SCOPES =
    // Collections.singletonList(DriveScopes.DRIVE);

    private static final List<String> SCOPES = Arrays.asList(DriveScopes.DRIVE);

    private static final String USER_IDENTIFIER_KEY = "MY_USER";

    //@Value(value = "google.oauth.callback.uri")
    @Value("${google.oauth.callback.uri}")
    private String CALLBACK_URI;

    //@Value(value = "google.secret.key.path")
    @Value("${google.secret.key.path}")
    private Resource gdSecretKeys;

    //@Value(value = "google.credentials.folder.path")
    @Value("${google.credentials.folder.path}")
    private Resource credentialsFolder;

    //@Value(value = "google.service.account.key")
    @Value("${google.service.account.key}")
    private Resource serviceAccountKey;

    private GoogleAuthorizationCodeFlow flow;

    @PostConstruct
    public void init() throws Exception {
        GoogleClientSecrets secrets = GoogleClientSecrets.load(JSON_FACTORY,
                new InputStreamReader(gdSecretKeys.getInputStream()));
        flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, secrets, SCOPES)
                .setDataStoreFactory(new FileDataStoreFactory(credentialsFolder.getFile())).build();
    }

    @GetMapping(value = { "/" })
    public String showHomePage() throws Exception {
        boolean isUserAuthenticated = false;

        Credential credential = flow.loadCredential(USER_IDENTIFIER_KEY);
        if (credential != null) {
            boolean tokenValid = credential.refreshToken();
            if (tokenValid) {
                isUserAuthenticated = true;
            }
        }

        return isUserAuthenticated ? "dashboard.html" : "index.html";
    }

    @GetMapping(value = { "/googlesignin" })
    public void doGoogleSignIn(HttpServletResponse response) throws Exception {
        GoogleAuthorizationCodeRequestUrl url = flow.newAuthorizationUrl();
        String redirectURL = url.setRedirectUri(CALLBACK_URI).setAccessType("offline").build();
        response.sendRedirect(redirectURL);
    }

    @GetMapping(value = { "/oauth" })
    public String saveAuthorizationCode(HttpServletRequest request) throws Exception {
        String code = request.getParameter("code");
        if (code != null) {
            saveToken(code);

            return "dashboard.html";
        }

        return "index.html";
    }

    private void saveToken(String code) throws Exception {
        GoogleTokenResponse response = flow.newTokenRequest(code).setRedirectUri(CALLBACK_URI).execute();
        flow.createAndStoreCredential(response, USER_IDENTIFIER_KEY);

    }

}

</code>```

This is the error that i recive in debug mode :

```
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homepageController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'google.service.account.key' in value "${google.service.account.key}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at com.collaborative.gsuite.collaborativegsuite.CollaborativeApplication.main(CollaborativeApplication.java:10) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_191]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'google.service.account.key' in value "${google.service.account.key}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:912) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 23 common frames omitted

2020-05-30 15:18:08.080  WARN 26688 --- [  restartedMain] o.s.boot.SpringApplication               : Unable to close ApplicationContext

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServerEventListener' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServerEventListener' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'optionalLiveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'optionalLiveReloadServer' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServer' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:81) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:67) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:167) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:814) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at com.collaborative.gsuite.collaborativegsuite.CollaborativeApplication.main(CollaborativeApplication.java:10) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_191]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'optionalLiveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'optionalLiveReloadServer' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServer' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 28 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServer' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:359) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.devtools.restart.Restarter.getOrAddAttribute(Restarter.java:460) ~[spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.devtools.restart.RestartScopeInitializer$RestartScope.get(RestartScopeInitializer.java:44) ~[spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:356) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 42 common frames omitted
Caused by: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:92) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:78) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 57 common frames omitted
Caused by: java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1095) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1113) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.context.properties.BoundConfigurationProperties.get(BoundConfigurationProperties.java:78) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.getHandler(ConfigurationPropertiesBinder.java:127) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.getBindHandler(ConfigurationPropertiesBinder.java:109) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:89) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:89) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    ... 71 common frames omitted

```

What i want to do is have the permits to use the google drive API, accept the terms and go redirect on -> index.html.

Someone could help me to fix this error and explains why i've received it? I've search it but i havent find something to fix the error.

I thank you in advance for the support guys!

答: You need to define google.service.account.key in you application.properties file of the module or of the project level build.gradle file or pom.xml file, whichever you are using.

Body:
I state that I am new on the forum and I am a beginner with Java, so I apologize in advance for any mistakes.

I'm working on a web application in Java, using Spring Boot, to utilize Google Drive API for list files on my Google Drive. I'm follow the courses on youtube from carbonrider, so the main and the controller are the same created from him, but in debug I receive an error about creating beans. I'll show you the code :

CollaborativeApplication.java

package com.collaborative.gsuite.collaborativegsuite;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CollaborativeApplication {

    public static void main(String[] args) {
        SpringApplication.run(CollaborativeApplication.class, args);
    }

}

HomePageController.java

package com.collaborative.gsuite.collaborativegsuite.controller;

import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.drive.DriveScopes;

@Controller
public class HomepageController {

    private static HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
    private static JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();

    // private static final List<String> SCOPES =
    // Collections.singletonList(DriveScopes.DRIVE);

    private static final List<String> SCOPES = Arrays.asList(DriveScopes.DRIVE);

    private static final String USER_IDENTIFIER_KEY = "MY_USER";

    //@Value(value = "google.oauth.callback.uri")
    @Value("${google.oauth.callback.uri}")
    private String CALLBACK_URI;

    //@Value(value = "google.secret.key.path")
    @Value("${google.secret.key.path}")
    private Resource gdSecretKeys;

    //@Value(value = "google.credentials.folder.path")
    @Value("${google.credentials.folder.path}")
    private Resource credentialsFolder;

    //@Value(value = "google.service.account.key")
    @Value("${google.service.account.key}")
    private Resource serviceAccountKey;

    private GoogleAuthorizationCodeFlow flow;

    @PostConstruct
    public void init() throws Exception {
        GoogleClientSecrets secrets = GoogleClientSecrets.load(JSON_FACTORY,
                new InputStreamReader(gdSecretKeys.getInputStream()));
        flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, secrets, SCOPES)
                .setDataStoreFactory(new FileDataStoreFactory(credentialsFolder.getFile())).build();
    }

    @GetMapping(value = { "/" })
    public String showHomePage() throws Exception {
        boolean isUserAuthenticated = false;

        Credential credential = flow.loadCredential(USER_IDENTIFIER_KEY);
        if (credential != null) {
            boolean tokenValid = credential.refreshToken();
            if (tokenValid) {
                isUserAuthenticated = true;
            }
        }

        return isUserAuthenticated ? "dashboard.html" : "index.html";
    }

    @GetMapping(value = { "/googlesignin" })
    public void doGoogleSignIn(HttpServletResponse response) throws Exception {
        GoogleAuthorizationCodeRequestUrl url = flow.newAuthorizationUrl();
        String redirectURL = url.setRedirectUri(CALLBACK_URI).setAccessType("offline").build();
        response.sendRedirect(redirectURL);
    }

    @GetMapping(value = { "/oauth" })
    public String saveAuthorizationCode(HttpServletRequest request) throws Exception {
        String code = request.getParameter("code");
        if (code != null) {
            saveToken(code);

            return "dashboard.html";
        }

        return "index.html";
    }

    private void saveToken(String code) throws Exception {
        GoogleTokenResponse response = flow.newTokenRequest(code).setRedirectUri(CALLBACK_URI).execute();
        flow.createAndStoreCredential(response, USER_IDENTIFIER_KEY);

    }

}

This is the error that i recive in debug mode :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'homepageController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'google.service.account.key' in value "${google.service.account.key}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at com.collaborative.gsuite.collaborativegsuite.CollaborativeApplication.main(CollaborativeApplication.java:10) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_191]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'google.service.account.key' in value "${google.service.account.key}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:912) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 23 common frames omitted

2020-05-30 15:18:08.080  WARN 26688 --- [  restartedMain] o.s.boot.SpringApplication               : Unable to close ApplicationContext

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServerEventListener' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServerEventListener' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'optionalLiveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'optionalLiveReloadServer' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServer' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:81) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:67) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:167) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:814) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at com.collaborative.gsuite.collaborativegsuite.CollaborativeApplication.main(CollaborativeApplication.java:10) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_191]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_191]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'optionalLiveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'optionalLiveReloadServer' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServer' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 28 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'liveReloadServer' defined in class path resource [org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration$LiveReloadConfiguration.class]: Unsatisfied dependency expressed through method 'liveReloadServer' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:539) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:359) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.devtools.restart.Restarter.getOrAddAttribute(Restarter.java:460) ~[spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.devtools.restart.RestartScopeInitializer$RestartScope.get(RestartScopeInitializer.java:44) ~[spring-boot-devtools-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:356) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 42 common frames omitted
Caused by: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties': Could not bind properties to 'DevToolsProperties' : prefix=spring.devtools, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:92) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:78) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1306) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    ... 57 common frames omitted
Caused by: java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@68dddbd6 has not been refreshed yet
    at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1095) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1113) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.context.properties.BoundConfigurationProperties.get(BoundConfigurationProperties.java:78) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.getHandler(ConfigurationPropertiesBinder.java:127) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.getBindHandler(ConfigurationPropertiesBinder.java:109) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:89) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:89) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    ... 71 common frames omitted

What i want to do is have the permits to use the google drive API, accept the terms and go redirect on -> index.html.

Someone could help me to fix this error and explains why i've received it? I've search it but i havent find something to fix the error.

I thank you in advance for the support guys!


问:
Access all View attributes from InputMethodService
I'm trying to access some attributes from the View that launched my keyboard. For instance if I have the following view in my app:

```<code><EditText
  android:contentDescription="content description"
  android:privateImeOptions="private ime options" />
</code>```

I can access the privateImeOptions from my InputMethodService like so:

```<code>@Override
public void onStartInputView(EditorInfo info, boolean restarting) {
    final String privateImeOptions = info.privateImeOptions;
}
</code>```

However I cannot access the contentDescription attribute in the same way.

Is there a way I can read specific attributes such as the contentDescription of the View that launched the IME? I only need read access to the attribute, I don't need to change it.

答:
The short answer to this is no, there is no way to access the attributes from an InputMethodService

However, there is a solution using an AccessibilityService to read the View attributes, and then pass this information to the InputMethodService.

There's no way to confirm the keyboard and accessibility service Views match, but you can assume that the View in focus is the one that launched the keyboard. To get the View in focus from the accessibility service you can use

```<code>final AccessibilityNodeInfo focusedView = findFocus(AccessibilityNodeInfo.FOCUS_INPUT);
</code>```

It's probably not an ideal solution for most situations but I wanted to document it for anyone else who might find it useful in the future

Body:
I'm trying to access some attributes from the View that launched my keyboard. For instance if I have the following view in my app:

<EditText
  android:contentDescription="content description"
  android:privateImeOptions="private ime options" />

I can access the privateImeOptions from my InputMethodService like so:

@Override
public void onStartInputView(EditorInfo info, boolean restarting) {
    final String privateImeOptions = info.privateImeOptions;
}

However I cannot access the contentDescription attribute in the same way.

Is there a way I can read specific attributes such as the contentDescription of the View that launched the IME? I only need read access to the attribute, I don't need to change it.

Body:
The short answer to this is no, there is no way to access the attributes from an InputMethodService

However, there is a solution using an AccessibilityService to read the View attributes, and then pass this information to the InputMethodService.

There's no way to confirm the keyboard and accessibility service Views match, but you can assume that the View in focus is the one that launched the keyboard. To get the View in focus from the accessibility service you can use

final AccessibilityNodeInfo focusedView = findFocus(AccessibilityNodeInfo.FOCUS_INPUT);

It's probably not an ideal solution for most situations but I wanted to document it for anyone else who might find it useful in the future


问:
How can I use .xcconfig files in Xcode 4?
I just switched over to Xcode 4 and I'm having trouble working with .xcconfig files for build settings. My targets that already had files assigned in Xcode 3 are all set up - a column titled Config.file shows up in the Levels view of Build Settings. But I can't figure out how to edit the columns in this view or where to put an .xcconfig file to attach it to a new target. I've looked online and haven't found an answer. Anybody know how to do this?</p>

答:
Pick File | New, choose Other and "Configuration Settings File", this gets you a new .xcconfig file.

Then click on the project on the upper left in the file browser (the same place where you get to build settings), click on the project again in the second-to-left panel, and click on the Info tab at the top of the inner panel.

There, you can choose "Based on Configuration File" for each of your targets for each of your configurations (debug, release, etc.)


问:
How to get the whole row based on a max value from one column in pandas.groupby().max()?
I want to specify that I need to get the whole row for a max value, not different max values from multiple rows, in my example this should be based on the column 'Number'. Such as this way:

```<code>import pandas as pd

data = {
    'Number':[12,55,3,2,88,17],
    'People':['Zack','Zack','Merry','Merry','Cross','Cross'],
    'Random':[353,0.5454,0.5454336,32,-7,4]
}

df = pd.DataFrame (data, columns = ['Number','People','Random'])

print(df,'\n')

max_values = df.groupby('People').max()

print(max_values)
</code>```

Here is the result:

```<code>   Number People      Random
0      12   Zack  353.000000
1      55   Zack    0.545400
2       3  Merry    0.545434
3       2  Merry   32.000000
4      88  Cross   -7.000000
5      17  Cross    4.000000

        Number  Random
People
Cross       88     4.0
Merry        3    32.0
Zack        55   353.0
</code>```

Here is the expected result for max_values:

```<code>        Number  Random
People
Cross       88    -7.000000
Merry        3    0.545434
Zack        55   353.0
</code>```

答:
You could try something like this - </p>

```<code>df['max_number'] = df.groupby(['People'])['Number'].transform(max)
df[df.Number == df.max_number].drop('max_number', axis=1).set_index('People')

         Number Random
People
Zack        55  0.545400
Merry        3  0.545434
Cross       88 -7.000000
</code>```

Body:
I want to specify that I need to get the whole row for a max value, not different max values from multiple rows, in my example this should be based on the column 'Number'. Such as this way:

import pandas as pd

data = {
    'Number':[12,55,3,2,88,17],
    'People':['Zack','Zack','Merry','Merry','Cross','Cross'],
    'Random':[353,0.5454,0.5454336,32,-7,4]
}

df = pd.DataFrame (data, columns = ['Number','People','Random'])

print(df,'\n')

max_values = df.groupby('People').max()

print(max_values)

Here is the result:

   Number People      Random
0      12   Zack  353.000000
1      55   Zack    0.545400
2       3  Merry    0.545434
3       2  Merry   32.000000
4      88  Cross   -7.000000
5      17  Cross    4.000000

        Number  Random
People
Cross       88     4.0
Merry        3    32.0
Zack        55   353.0

Here is the expected result for max_values:

        Number  Random
People
Cross       88    -7.000000
Merry        3    0.545434
Zack        55   353.0

Body:
You could try something like this -

df['max_number'] = df.groupby(['People'])['Number'].transform(max)
df[df.Number == df.max_number].drop('max_number', axis=1).set_index('People')

         Number Random
People
Zack        55  0.545400
Merry        3  0.545434
Cross       88 -7.000000


问:
How to add a string to my blog post path instead of integer with get_absolute_url in django?
I'm working on a simple blog project and have been following Corey Schafer on YouTube. In the tutorials, he creates new blog posts with integers (e.g. /blog/1, /blog/2, and so on), but I would like to create my post path with strings (like blog/my-blog-post, /blog/new-blog-post). I'm pretty new to python and django and I've tried some things with little luck. Any tips on how to do this?

Models:

```<code>class BloggPost(models.Model):
    tittel = models.CharField(max_length=100)
    innhold = models.TextField()
    date_posted = models.DateTimeField(default=timezone.now)
    author = models.ForeignKey(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to='blogg_foto')

    def __str__(self):
        return self.tittel

    def get_absolute_url(self):
        return reverse('post-detail', kwargs={'pk': self.pk})
</code>```

Urls:

```<code>from django.urls import path
from .views import BloggPostListViewHome, BloggPostListView, BloggPostDetailView
from . import views

path('blogg/<int:pk>/', BloggPostDetailView.as_view(), name='bloggpost-detail'),
</code>```

答:
You can define a slug field, for example with an AutoSlugField from the django-autoslug package [readthedocs].

You can install that in the virtual environment with:

```<code>pip install <b>django-autoslug</b></code>```

then you can add an AutoSlugField to your model with:

```<code>from autoslug import AutoSlugField

class BloggPost(models.Model):
    tittel = models.CharField(max_length=100)
    slug = AutoSlugField(<b>populate_from='tittel'</b>)
    innhold = models.TextField()
    date_posted = models.DateTimeField(default=timezone.now)
    author = models.ForeignKey(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to='blogg_foto')

    def __str__(self):
        return self.tittel

    def get_absolute_url(self):
        return reverse('post-detail', kwargs={<b>'slug'</b>: self.<b>slug</b>})</code>```

In your urls.py you then define a pattern with:

```<code>path('blogg/<b><slug:slug></b>/', BloggPostDetailView.as_view(), name='bloggpost-detail'),</code>```

Class-based views with a SingleObjectMixin, such as a DetailView and an UpdateView, will perform filtering automatically on a slug if a slug field exists in the URL patterns.

Body:
I'm working on a simple blog project and have been following Corey Schafer on YouTube. In the tutorials, he creates new blog posts with integers (e.g. /blog/1, /blog/2, and so on), but I would like to create my post path with strings (like blog/my-blog-post, /blog/new-blog-post). I'm pretty new to python and django and I've tried some things with little luck. Any tips on how to do this?

Models:

class BloggPost(models.Model):
    tittel = models.CharField(max_length=100)
    innhold = models.TextField()
    date_posted = models.DateTimeField(default=timezone.now)
    author = models.ForeignKey(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to='blogg_foto')

    def __str__(self):
        return self.tittel

    def get_absolute_url(self):
        return reverse('post-detail', kwargs={'pk': self.pk})

Urls:

from django.urls import path
from .views import BloggPostListViewHome, BloggPostListView, BloggPostDetailView
from . import views

path('blogg/<int:pk>/', BloggPostDetailView.as_view(), name='bloggpost-detail'),

Body:
You can define a slug field, for example with an AutoSlugField from the django-autoslug package [readthedocs].

You can install that in the virtual environment with:

pip install django-autoslug

then you can add an AutoSlugField to your model with:

from autoslug import AutoSlugField

class BloggPost(models.Model):
    tittel = models.CharField(max_length=100)
    slug = AutoSlugField(populate_from='tittel')
    innhold = models.TextField()
    date_posted = models.DateTimeField(default=timezone.now)
    author = models.ForeignKey(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to='blogg_foto')

    def __str__(self):
        return self.tittel

    def get_absolute_url(self):
        return reverse('post-detail', kwargs={'slug': self.slug})

In your urls.py you then define a pattern with:

path('blogg/<slug:slug>/', BloggPostDetailView.as_view(), name='bloggpost-detail'),

Class-based views with a SingleObjectMixin, such as a DetailView and an UpdateView, will perform filtering automatically on a slug if a slug field exists in the URL patterns.


问:
NightwatchJS capture network traffic / network response
I have a ReactJS SPA that I'm testing, specifically I'm testing user signup.

This is a response value from the GET request that my SPA makes when a user has signs up.

```<code>{"data":{"id":1387,"token":"3f38cfd0-a392-11e7-8d24-130a2af7f20a"}}
</code>```

How can I access the data returned from network requests made from my SPA within NightwatchJS?

答:
Jonathan is right.

And here is full demo to capture the XHR traffic:

https://github.com/Bugazelle/nightwatch-capture-network-traffic

How it is working

Take advantage of the ajaxListener.js

The js is forked from https://gist.github.com/icodejs/3183154

This hack will make all the XHR requests as a warn log to console

```<code>    {
        "type": "response",
        "syncMode": this.syncMode,
        "method": this.method,
        "url": this.url,
        "requestData": this.requestData,
        "readyState": this.readyState,
        "responseText": this.responseText,
        "responseCode": this.status,
        "responseHeader": this.getAllResponseHeaders()
    }
</code>```

Then take advantage of Nightwatch API .getLog

The .getLog could capture the console warn logs for us

Body:
I have a ReactJS SPA that I'm testing, specifically I'm testing user signup.

This is a response value from the GET request that my SPA makes when a user has signs up.

{"data":{"id":1387,"token":"3f38cfd0-a392-11e7-8d24-130a2af7f20a"}}

How can I access the data returned from network requests made from my SPA within NightwatchJS?

Body:
Jonathan is right.

And here is full demo to capture the XHR traffic:

https://github.com/Bugazelle/nightwatch-capture-network-traffic

How it is working

Take advantage of the ajaxListener.js

The js is forked from https://gist.github.com/icodejs/3183154

This hack will make all the XHR requests as a warn log to console

    {
        "type": "response",
        "syncMode": this.syncMode,
        "method": this.method,
        "url": this.url,
        "requestData": this.requestData,
        "readyState": this.readyState,
        "responseText": this.responseText,
        "responseCode": this.status,
        "responseHeader": this.getAllResponseHeaders()
    }

Then take advantage of Nightwatch API .getLog

The .getLog could capture the console warn logs for us


问:
HTML when there is no more space for a cell, start on a new line
So I am trying to make an 'inventory', and in each 'slot' (td) there will be an item, a bit like this:

Now as you can see, I have made it to fit a total of 12 products in each "row", I want it to be able to print in 12 products, then start not he next line, and print 12 more, etc.

So it looks like this right now:

And as you can see, item 13 to 24 are just following along, and I want it to be underneath item 1 to 12, just like the first picture.

Thanks

答:
you needle to put 12 cells in a row. Then you need to divide the window widht between 12 and the result you obtain you need to put it as the widht of each cell. Later put  display: inline-block in all the cells.
Hope I help you.</p>


问:
How to clear previous activity stack and Exit Application on back button?
I have three activities:

```<code>A,B,C
</code>```

A is home screen.

Activities are launched as follow  A->B->C

If I come to home screen using backbutton, I want to clear activity stack/previous activities history and it should exit the application.

Can anyone guide me how to achieve this?

答:
You can do following:

1. Set clearTaskOnLaunch = "true" in AndroidManifest, in declaration of activity A

2. In activity C:

```<code>@Override
public void onBackPressed(){
    moveTaskToBack(true);
}
</code>```

So if user presses back - it comes back to homescreen.

If user launches application again - task stack clears and he comes to root activity (A)

Body:
I have three activities:

A,B,C

A is home screen.

Activities are launched as follow  A->B->C

If I come to home screen using backbutton, I want to clear activity stack/previous activities history and it should exit the application.

Can anyone guide me how to achieve this?

Body:
You can do following:

1. Set clearTaskOnLaunch = "true" in AndroidManifest, in declaration of activity A

2. In activity C:

@Override
public void onBackPressed(){
    moveTaskToBack(true);
}

So if user presses back - it comes back to homescreen.

If user launches application again - task stack clears and he comes to root activity (A)


问:
How to overlap box-shadows on table rows?
I have a table on which I want to highlight a number of successive rows (TR's) by applying a box-shadow around them.

My strategy was to apply a class called "selected-top" to the first row of the selection, classes "selected-middle" for the middle part, and "selected-bottom" for the last row.

However, the shadows of the middle rows bleed over. I tried to rectify this by using z-index (I know that I have to add a relative property with that, so I did), but they seem to have no effect:

Here's the code:

```<code>  tr.selected-top {
    box-shadow: -5px -5px 5px #000, 5px -5px 5px #000;
    position: relative;
    z-index:10;
  }
  tr.selected-middle {
    box-shadow: -5px 0px 5px #000, 5px 0px 5px #000;
    position: relative;
    z-index: -1;
  }
</code>```

The table is just a regular table:

```<code><table>
<tr><td>stuff</td></tr>
<tr class="selected-top"><td>highlighting starts</td></tr>
<tr class="selected-middle"><td>highlighting middle</td></tr>
<tr class="selected-bottom"><td>highlighting end</td></tr>
<tr><td>other stuff</td></tr>
</table>
</code>```

What am I doing wrong?

By the way, I did try to only apply a shadow to only the sides for the middle rows, but that way the shadow is not continuous.

Update: @Aditya Toke, like so: (left is wrong shading, right is correct shading)

答:
table {

  height: 67vh;
    width: 59vw;
    background-color: #333333;
}

td {
/*   background-color: #333333; */
    color: white;
}

div {
  display: flex;
  justify-content: center;
  align-items: center;
}

.div1 {
  box-shadow: -5px -5px 5px #000, 5px -5px 5px #000;
  height: 100%;
  border: 1px solid darkgrey;
  border-left: 0;
  border-right: 0;
}

.div2 {
 box-shadow: -4px 0px 2px 0.5px #000, 2px 0px 0.5px 0.5px #000, 5px 0.5px 3px 0px #000;
  height: 100%;
  border: 1px solid #333333;
}

.div3 {
  box-shadow: -6px 3px 5px #000, 6px 5px 6px 1px #000;
  height: 100%;
  position: relative;
  border: 1px solid darkgrey;
  border-left: 0;
  border-right: 0;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<body>

  <table>
    <tr>
      <td>stuff</td>
    </tr>
    <tr class="selected-top">
      <td>
        <div class="div1">
          highlighting starts
        </div>
      </td>
    </tr>
    <tr class="selected-middle">
      <td>
        <div class="div2">
          highlighting middle
        </div>
      </td>
    </tr>
    <tr class="selected-bottom">
      <td>
        <div class="div3">
          highlighting end
        </div>
      </td>
    </tr>
    <tr>
      <td>other stuff</td>
    </tr>
  </table>

</body>

</html></code>```

I tried to create similar to what you have provided in the expected output

Body:
I have a table on which I want to highlight a number of successive rows (TR's) by applying a box-shadow around them.

My strategy was to apply a class called "selected-top" to the first row of the selection, classes "selected-middle" for the middle part, and "selected-bottom" for the last row.

However, the shadows of the middle rows bleed over. I tried to rectify this by using z-index (I know that I have to add a relative property with that, so I did), but they seem to have no effect:

Here's the code:

  tr.selected-top {
    box-shadow: -5px -5px 5px #000, 5px -5px 5px #000;
    position: relative;
    z-index:10;
  }
  tr.selected-middle {
    box-shadow: -5px 0px 5px #000, 5px 0px 5px #000;
    position: relative;
    z-index: -1;
  }

The table is just a regular table:

stuff

highlighting starts

highlighting middle

highlighting end

other stuff

What am I doing wrong?

By the way, I did try to only apply a shadow to only the sides for the middle rows, but that way the shadow is not continuous.

Update: @Aditya Toke, like so: (left is wrong shading, right is correct shading)

Body:
table {

  height: 67vh;
    width: 59vw;
    background-color: #333333;
}

td {
/*   background-color: #333333; */
    color: white;
}

div {
  display: flex;
  justify-content: center;
  align-items: center;
}

.div1 {
  box-shadow: -5px -5px 5px #000, 5px -5px 5px #000;
  height: 100%;
  border: 1px solid darkgrey;
  border-left: 0;
  border-right: 0;
}

.div2 {
 box-shadow: -4px 0px 2px 0.5px #000, 2px 0px 0.5px 0.5px #000, 5px 0.5px 3px 0px #000;
  height: 100%;
  border: 1px solid #333333;
}

.div3 {
  box-shadow: -6px 3px 5px #000, 6px 5px 6px 1px #000;
  height: 100%;
  position: relative;
  border: 1px solid darkgrey;
  border-left: 0;
  border-right: 0;
}

<!DOCTYPE html>
<html lang="en">

<body>

  <table>
    <tr>
      <td>stuff</td>
    </tr>
    <tr class="selected-top">
      <td>
        <div class="div1">
          highlighting starts
        </div>
      </td>
    </tr>
    <tr class="selected-middle">
      <td>
        <div class="div2">
          highlighting middle
        </div>
      </td>
    </tr>
    <tr class="selected-bottom">
      <td>
        <div class="div3">
          highlighting end
        </div>
      </td>
    </tr>
    <tr>
      <td>other stuff</td>
    </tr>
  </table>

</body>

</html>

I tried to create similar to what you have provided in the expected output


问:
Is there any data structure that has no duplicates but can have elements added to it while being iterated over?
I know a set has no duplicates but the issue is that I can't add elements to it while iterating over it using an iterator or for each loop. Is there any other way? Thank you.</p>

答:
Not sure whether below approach fixes your problem but you can try it:</p>

```<code>    HashSet<Integer> original = new HashSet<>();
    HashSet<Integer> elementsToAdd = new HashSet<>();
    elementsToAdd.add(element); //while iterating original
    original.addAll(elementsToAdd); //Once done with iterating, just add all.
</code>```

Body:
Not sure whether below approach fixes your problem but you can try it:

    HashSet<Integer> original = new HashSet<>();
    HashSet<Integer> elementsToAdd = new HashSet<>();
    elementsToAdd.add(element); //while iterating original
    original.addAll(elementsToAdd); //Once done with iterating, just add all.


问:
How to use environment variable in index.html for Angular 6
I am using angular6, in my project I am using Facebook Account Toolkit for mobile verification purpose.

I need to initialise Account toolkit in index.html file using following code.

```<code>  AccountKit.init({
   appId:"XX",
   state:"xx",
   version:"v1.2",
   fbAppEventsEnabled:true,
   debug:true
 });
</code>```

The problem is, values for appId and state change depending on environment (development/test/production).

How can I use environment variables in index.html file.

Please let me know if anyone has a solution for angular 6.

答:
This answer supersedes Artyom's answer for Angular 8 and above. Add the following to your angular.json:

```<code>"production": {
  "index": {
    "input": "src/index.someenv.html",
    "output": "index.html"
  },
},
</code>```

Body:
I am using angular6, in my project I am using Facebook Account Toolkit for mobile verification purpose.

I need to initialise Account toolkit in index.html file using following code.

  AccountKit.init({
   appId:"XX",
   state:"xx",
   version:"v1.2",
   fbAppEventsEnabled:true,
   debug:true
 });

The problem is, values for appId and state change depending on environment (development/test/production).

How can I use environment variables in index.html file.

Please let me know if anyone has a solution for angular 6.

Body:
This answer supersedes Artyom's answer for Angular 8 and above. Add the following to your angular.json:

"production": {
  "index": {
    "input": "src/index.someenv.html",
    "output": "index.html"
  },
},