Purpose of SpringBoot import, then exclude pattern? [duplicate]












0
















This question already has an answer here:




  • Meaning of the import statement in a Java file

    5 answers




I am relatively new to Java, as a JS dev, working on a SpringBoot application I see a pattern that peaked my curiosity:



Within the Application.java there are several import classes, which are then marked exclude within @SpringBootApplication, eg



import org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration;
...
@SpringBootApplication(
exclude = {DataBaseAutoConfiguration.class, ...}
)


DataBaseAutoConfiguration is not referenced anyplace else in the codebase, except here.



Can someone explain the purpose of this pattern? It feels odd to import the class then immediately exclude it in the configuration



Why not have something like:



exclude = {"DataBaseAutoConfiguration", ...} then lookup the class to ignore within Spring, avoiding the apparent "useless" import?



or:



// import nothing
@SpringBootApplication









share|improve this question















marked as duplicate by Sotirios Delimanolis java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 22:58


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • "Meaning of the import statement in a Java file" is off topic and not helpful to this question

    – Vinnie James
    Nov 15 '18 at 23:35











  • Please clarify. If you understand what import does, are you just asking what SpringBootApplication's exclude element does?

    – Sotirios Delimanolis
    Nov 15 '18 at 23:37






  • 1





    exclude's type is Class, so it expects Class values, not String values like you suggest. There's an excludeName that takes a String, but you'd need to provide the fully qualified type name, so excludeName = {"org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration"}. Using the Class literal makes this more type safe.

    – Sotirios Delimanolis
    Nov 15 '18 at 23:41











  • I'm aware of how import works, and a bit how exclude works. The question is more how the two interact, it feels like import thing...unimport thing and stood out

    – Vinnie James
    Nov 15 '18 at 23:44











  • The import has no effect other than letting you use the simple name of the class. You can very well have had exclude = {org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration.class} with no import statement. The language feature is completely unrelated to an element of some annotation.

    – Sotirios Delimanolis
    Nov 16 '18 at 0:21


















0
















This question already has an answer here:




  • Meaning of the import statement in a Java file

    5 answers




I am relatively new to Java, as a JS dev, working on a SpringBoot application I see a pattern that peaked my curiosity:



Within the Application.java there are several import classes, which are then marked exclude within @SpringBootApplication, eg



import org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration;
...
@SpringBootApplication(
exclude = {DataBaseAutoConfiguration.class, ...}
)


DataBaseAutoConfiguration is not referenced anyplace else in the codebase, except here.



Can someone explain the purpose of this pattern? It feels odd to import the class then immediately exclude it in the configuration



Why not have something like:



exclude = {"DataBaseAutoConfiguration", ...} then lookup the class to ignore within Spring, avoiding the apparent "useless" import?



or:



// import nothing
@SpringBootApplication









share|improve this question















marked as duplicate by Sotirios Delimanolis java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 22:58


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • "Meaning of the import statement in a Java file" is off topic and not helpful to this question

    – Vinnie James
    Nov 15 '18 at 23:35











  • Please clarify. If you understand what import does, are you just asking what SpringBootApplication's exclude element does?

    – Sotirios Delimanolis
    Nov 15 '18 at 23:37






  • 1





    exclude's type is Class, so it expects Class values, not String values like you suggest. There's an excludeName that takes a String, but you'd need to provide the fully qualified type name, so excludeName = {"org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration"}. Using the Class literal makes this more type safe.

    – Sotirios Delimanolis
    Nov 15 '18 at 23:41











  • I'm aware of how import works, and a bit how exclude works. The question is more how the two interact, it feels like import thing...unimport thing and stood out

    – Vinnie James
    Nov 15 '18 at 23:44











  • The import has no effect other than letting you use the simple name of the class. You can very well have had exclude = {org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration.class} with no import statement. The language feature is completely unrelated to an element of some annotation.

    – Sotirios Delimanolis
    Nov 16 '18 at 0:21
















0












0








0


1







This question already has an answer here:




  • Meaning of the import statement in a Java file

    5 answers




I am relatively new to Java, as a JS dev, working on a SpringBoot application I see a pattern that peaked my curiosity:



Within the Application.java there are several import classes, which are then marked exclude within @SpringBootApplication, eg



import org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration;
...
@SpringBootApplication(
exclude = {DataBaseAutoConfiguration.class, ...}
)


DataBaseAutoConfiguration is not referenced anyplace else in the codebase, except here.



Can someone explain the purpose of this pattern? It feels odd to import the class then immediately exclude it in the configuration



Why not have something like:



exclude = {"DataBaseAutoConfiguration", ...} then lookup the class to ignore within Spring, avoiding the apparent "useless" import?



or:



// import nothing
@SpringBootApplication









share|improve this question

















This question already has an answer here:




  • Meaning of the import statement in a Java file

    5 answers




I am relatively new to Java, as a JS dev, working on a SpringBoot application I see a pattern that peaked my curiosity:



Within the Application.java there are several import classes, which are then marked exclude within @SpringBootApplication, eg



import org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration;
...
@SpringBootApplication(
exclude = {DataBaseAutoConfiguration.class, ...}
)


DataBaseAutoConfiguration is not referenced anyplace else in the codebase, except here.



Can someone explain the purpose of this pattern? It feels odd to import the class then immediately exclude it in the configuration



Why not have something like:



exclude = {"DataBaseAutoConfiguration", ...} then lookup the class to ignore within Spring, avoiding the apparent "useless" import?



or:



// import nothing
@SpringBootApplication




This question already has an answer here:




  • Meaning of the import statement in a Java file

    5 answers








java spring-boot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 23:51







Vinnie James

















asked Nov 15 '18 at 22:13









Vinnie JamesVinnie James

2,32112230




2,32112230




marked as duplicate by Sotirios Delimanolis java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 22:58


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Sotirios Delimanolis java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 22:58


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • "Meaning of the import statement in a Java file" is off topic and not helpful to this question

    – Vinnie James
    Nov 15 '18 at 23:35











  • Please clarify. If you understand what import does, are you just asking what SpringBootApplication's exclude element does?

    – Sotirios Delimanolis
    Nov 15 '18 at 23:37






  • 1





    exclude's type is Class, so it expects Class values, not String values like you suggest. There's an excludeName that takes a String, but you'd need to provide the fully qualified type name, so excludeName = {"org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration"}. Using the Class literal makes this more type safe.

    – Sotirios Delimanolis
    Nov 15 '18 at 23:41











  • I'm aware of how import works, and a bit how exclude works. The question is more how the two interact, it feels like import thing...unimport thing and stood out

    – Vinnie James
    Nov 15 '18 at 23:44











  • The import has no effect other than letting you use the simple name of the class. You can very well have had exclude = {org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration.class} with no import statement. The language feature is completely unrelated to an element of some annotation.

    – Sotirios Delimanolis
    Nov 16 '18 at 0:21





















  • "Meaning of the import statement in a Java file" is off topic and not helpful to this question

    – Vinnie James
    Nov 15 '18 at 23:35











  • Please clarify. If you understand what import does, are you just asking what SpringBootApplication's exclude element does?

    – Sotirios Delimanolis
    Nov 15 '18 at 23:37






  • 1





    exclude's type is Class, so it expects Class values, not String values like you suggest. There's an excludeName that takes a String, but you'd need to provide the fully qualified type name, so excludeName = {"org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration"}. Using the Class literal makes this more type safe.

    – Sotirios Delimanolis
    Nov 15 '18 at 23:41











  • I'm aware of how import works, and a bit how exclude works. The question is more how the two interact, it feels like import thing...unimport thing and stood out

    – Vinnie James
    Nov 15 '18 at 23:44











  • The import has no effect other than letting you use the simple name of the class. You can very well have had exclude = {org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration.class} with no import statement. The language feature is completely unrelated to an element of some annotation.

    – Sotirios Delimanolis
    Nov 16 '18 at 0:21



















"Meaning of the import statement in a Java file" is off topic and not helpful to this question

– Vinnie James
Nov 15 '18 at 23:35





"Meaning of the import statement in a Java file" is off topic and not helpful to this question

– Vinnie James
Nov 15 '18 at 23:35













Please clarify. If you understand what import does, are you just asking what SpringBootApplication's exclude element does?

– Sotirios Delimanolis
Nov 15 '18 at 23:37





Please clarify. If you understand what import does, are you just asking what SpringBootApplication's exclude element does?

– Sotirios Delimanolis
Nov 15 '18 at 23:37




1




1





exclude's type is Class, so it expects Class values, not String values like you suggest. There's an excludeName that takes a String, but you'd need to provide the fully qualified type name, so excludeName = {"org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration"}. Using the Class literal makes this more type safe.

– Sotirios Delimanolis
Nov 15 '18 at 23:41





exclude's type is Class, so it expects Class values, not String values like you suggest. There's an excludeName that takes a String, but you'd need to provide the fully qualified type name, so excludeName = {"org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration"}. Using the Class literal makes this more type safe.

– Sotirios Delimanolis
Nov 15 '18 at 23:41













I'm aware of how import works, and a bit how exclude works. The question is more how the two interact, it feels like import thing...unimport thing and stood out

– Vinnie James
Nov 15 '18 at 23:44





I'm aware of how import works, and a bit how exclude works. The question is more how the two interact, it feels like import thing...unimport thing and stood out

– Vinnie James
Nov 15 '18 at 23:44













The import has no effect other than letting you use the simple name of the class. You can very well have had exclude = {org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration.class} with no import statement. The language feature is completely unrelated to an element of some annotation.

– Sotirios Delimanolis
Nov 16 '18 at 0:21







The import has no effect other than letting you use the simple name of the class. You can very well have had exclude = {org.springframework.boot.autoconfigure.data.database.DataBaseAutoConfiguration.class} with no import statement. The language feature is completely unrelated to an element of some annotation.

– Sotirios Delimanolis
Nov 16 '18 at 0:21














1 Answer
1






active

oldest

votes


















5














tl;dr import is a Java language feature, exclude is a Spring Boot feature.



You have to import classes to reference them in your code. The exclude in this case is specific to Spring Boot and is simply instructing the spring context to not trigger any of the configuration beans inside of DataBaseAutoConfiguration. Technically speaking, exclude is a field inside of the @SpringBootApplication annotation.



The import is only required so you can reference DataBaseAutoConfiguration in the code. Without the import, you would get a compile error.






share|improve this answer


























  • The reason I ask, is because the only reference to DataBaseAutoConfiguration is in the import/exclude. If DataBaseAutoConfiguration isnt used anywhere else, why the import/exclude?

    – Vinnie James
    Nov 15 '18 at 22:27






  • 1





    If you remove the exclude = {DataBaseAutoConfiguration.class, ...} then yes, you don't need the import statement. But this also means your app will load all of the configuration/beans from DataBaseAutoConfiguration, which may not be desirable for this particular app (i.e. if you have your own custom Database configuration class that handles creation of a Datasource, etc).

    – Mike
    Nov 15 '18 at 22:30











  • Is this because somewhere down the line Spring IS going to try to call DataBaseAutoConfiguration even though its not referenced again in the code. In this case it is imported, in order to reference here and tell Spring to ignore it when it comes up within Spring?

    – Vinnie James
    Nov 15 '18 at 22:31






  • 1





    Put another way: you need the import solely for the purpose of the compiler and JVM being able to find the definition of the DataBaseAutoConfiguration class to use in your code. You can't tell Spring Boot to exclude that class if the compiler and JVM don't even know how to load it.

    – Mike
    Nov 15 '18 at 22:32






  • 1





    Correct: presumably DataBaseAutoConfiguration is marked as @Configuration so without the exclude, Spring would scan it and load any beans and config from it.

    – Mike
    Nov 15 '18 at 22:33


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














tl;dr import is a Java language feature, exclude is a Spring Boot feature.



You have to import classes to reference them in your code. The exclude in this case is specific to Spring Boot and is simply instructing the spring context to not trigger any of the configuration beans inside of DataBaseAutoConfiguration. Technically speaking, exclude is a field inside of the @SpringBootApplication annotation.



The import is only required so you can reference DataBaseAutoConfiguration in the code. Without the import, you would get a compile error.






share|improve this answer


























  • The reason I ask, is because the only reference to DataBaseAutoConfiguration is in the import/exclude. If DataBaseAutoConfiguration isnt used anywhere else, why the import/exclude?

    – Vinnie James
    Nov 15 '18 at 22:27






  • 1





    If you remove the exclude = {DataBaseAutoConfiguration.class, ...} then yes, you don't need the import statement. But this also means your app will load all of the configuration/beans from DataBaseAutoConfiguration, which may not be desirable for this particular app (i.e. if you have your own custom Database configuration class that handles creation of a Datasource, etc).

    – Mike
    Nov 15 '18 at 22:30











  • Is this because somewhere down the line Spring IS going to try to call DataBaseAutoConfiguration even though its not referenced again in the code. In this case it is imported, in order to reference here and tell Spring to ignore it when it comes up within Spring?

    – Vinnie James
    Nov 15 '18 at 22:31






  • 1





    Put another way: you need the import solely for the purpose of the compiler and JVM being able to find the definition of the DataBaseAutoConfiguration class to use in your code. You can't tell Spring Boot to exclude that class if the compiler and JVM don't even know how to load it.

    – Mike
    Nov 15 '18 at 22:32






  • 1





    Correct: presumably DataBaseAutoConfiguration is marked as @Configuration so without the exclude, Spring would scan it and load any beans and config from it.

    – Mike
    Nov 15 '18 at 22:33
















5














tl;dr import is a Java language feature, exclude is a Spring Boot feature.



You have to import classes to reference them in your code. The exclude in this case is specific to Spring Boot and is simply instructing the spring context to not trigger any of the configuration beans inside of DataBaseAutoConfiguration. Technically speaking, exclude is a field inside of the @SpringBootApplication annotation.



The import is only required so you can reference DataBaseAutoConfiguration in the code. Without the import, you would get a compile error.






share|improve this answer


























  • The reason I ask, is because the only reference to DataBaseAutoConfiguration is in the import/exclude. If DataBaseAutoConfiguration isnt used anywhere else, why the import/exclude?

    – Vinnie James
    Nov 15 '18 at 22:27






  • 1





    If you remove the exclude = {DataBaseAutoConfiguration.class, ...} then yes, you don't need the import statement. But this also means your app will load all of the configuration/beans from DataBaseAutoConfiguration, which may not be desirable for this particular app (i.e. if you have your own custom Database configuration class that handles creation of a Datasource, etc).

    – Mike
    Nov 15 '18 at 22:30











  • Is this because somewhere down the line Spring IS going to try to call DataBaseAutoConfiguration even though its not referenced again in the code. In this case it is imported, in order to reference here and tell Spring to ignore it when it comes up within Spring?

    – Vinnie James
    Nov 15 '18 at 22:31






  • 1





    Put another way: you need the import solely for the purpose of the compiler and JVM being able to find the definition of the DataBaseAutoConfiguration class to use in your code. You can't tell Spring Boot to exclude that class if the compiler and JVM don't even know how to load it.

    – Mike
    Nov 15 '18 at 22:32






  • 1





    Correct: presumably DataBaseAutoConfiguration is marked as @Configuration so without the exclude, Spring would scan it and load any beans and config from it.

    – Mike
    Nov 15 '18 at 22:33














5












5








5







tl;dr import is a Java language feature, exclude is a Spring Boot feature.



You have to import classes to reference them in your code. The exclude in this case is specific to Spring Boot and is simply instructing the spring context to not trigger any of the configuration beans inside of DataBaseAutoConfiguration. Technically speaking, exclude is a field inside of the @SpringBootApplication annotation.



The import is only required so you can reference DataBaseAutoConfiguration in the code. Without the import, you would get a compile error.






share|improve this answer















tl;dr import is a Java language feature, exclude is a Spring Boot feature.



You have to import classes to reference them in your code. The exclude in this case is specific to Spring Boot and is simply instructing the spring context to not trigger any of the configuration beans inside of DataBaseAutoConfiguration. Technically speaking, exclude is a field inside of the @SpringBootApplication annotation.



The import is only required so you can reference DataBaseAutoConfiguration in the code. Without the import, you would get a compile error.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 15 '18 at 22:21

























answered Nov 15 '18 at 22:16









MikeMike

1,308717




1,308717













  • The reason I ask, is because the only reference to DataBaseAutoConfiguration is in the import/exclude. If DataBaseAutoConfiguration isnt used anywhere else, why the import/exclude?

    – Vinnie James
    Nov 15 '18 at 22:27






  • 1





    If you remove the exclude = {DataBaseAutoConfiguration.class, ...} then yes, you don't need the import statement. But this also means your app will load all of the configuration/beans from DataBaseAutoConfiguration, which may not be desirable for this particular app (i.e. if you have your own custom Database configuration class that handles creation of a Datasource, etc).

    – Mike
    Nov 15 '18 at 22:30











  • Is this because somewhere down the line Spring IS going to try to call DataBaseAutoConfiguration even though its not referenced again in the code. In this case it is imported, in order to reference here and tell Spring to ignore it when it comes up within Spring?

    – Vinnie James
    Nov 15 '18 at 22:31






  • 1





    Put another way: you need the import solely for the purpose of the compiler and JVM being able to find the definition of the DataBaseAutoConfiguration class to use in your code. You can't tell Spring Boot to exclude that class if the compiler and JVM don't even know how to load it.

    – Mike
    Nov 15 '18 at 22:32






  • 1





    Correct: presumably DataBaseAutoConfiguration is marked as @Configuration so without the exclude, Spring would scan it and load any beans and config from it.

    – Mike
    Nov 15 '18 at 22:33



















  • The reason I ask, is because the only reference to DataBaseAutoConfiguration is in the import/exclude. If DataBaseAutoConfiguration isnt used anywhere else, why the import/exclude?

    – Vinnie James
    Nov 15 '18 at 22:27






  • 1





    If you remove the exclude = {DataBaseAutoConfiguration.class, ...} then yes, you don't need the import statement. But this also means your app will load all of the configuration/beans from DataBaseAutoConfiguration, which may not be desirable for this particular app (i.e. if you have your own custom Database configuration class that handles creation of a Datasource, etc).

    – Mike
    Nov 15 '18 at 22:30











  • Is this because somewhere down the line Spring IS going to try to call DataBaseAutoConfiguration even though its not referenced again in the code. In this case it is imported, in order to reference here and tell Spring to ignore it when it comes up within Spring?

    – Vinnie James
    Nov 15 '18 at 22:31






  • 1





    Put another way: you need the import solely for the purpose of the compiler and JVM being able to find the definition of the DataBaseAutoConfiguration class to use in your code. You can't tell Spring Boot to exclude that class if the compiler and JVM don't even know how to load it.

    – Mike
    Nov 15 '18 at 22:32






  • 1





    Correct: presumably DataBaseAutoConfiguration is marked as @Configuration so without the exclude, Spring would scan it and load any beans and config from it.

    – Mike
    Nov 15 '18 at 22:33

















The reason I ask, is because the only reference to DataBaseAutoConfiguration is in the import/exclude. If DataBaseAutoConfiguration isnt used anywhere else, why the import/exclude?

– Vinnie James
Nov 15 '18 at 22:27





The reason I ask, is because the only reference to DataBaseAutoConfiguration is in the import/exclude. If DataBaseAutoConfiguration isnt used anywhere else, why the import/exclude?

– Vinnie James
Nov 15 '18 at 22:27




1




1





If you remove the exclude = {DataBaseAutoConfiguration.class, ...} then yes, you don't need the import statement. But this also means your app will load all of the configuration/beans from DataBaseAutoConfiguration, which may not be desirable for this particular app (i.e. if you have your own custom Database configuration class that handles creation of a Datasource, etc).

– Mike
Nov 15 '18 at 22:30





If you remove the exclude = {DataBaseAutoConfiguration.class, ...} then yes, you don't need the import statement. But this also means your app will load all of the configuration/beans from DataBaseAutoConfiguration, which may not be desirable for this particular app (i.e. if you have your own custom Database configuration class that handles creation of a Datasource, etc).

– Mike
Nov 15 '18 at 22:30













Is this because somewhere down the line Spring IS going to try to call DataBaseAutoConfiguration even though its not referenced again in the code. In this case it is imported, in order to reference here and tell Spring to ignore it when it comes up within Spring?

– Vinnie James
Nov 15 '18 at 22:31





Is this because somewhere down the line Spring IS going to try to call DataBaseAutoConfiguration even though its not referenced again in the code. In this case it is imported, in order to reference here and tell Spring to ignore it when it comes up within Spring?

– Vinnie James
Nov 15 '18 at 22:31




1




1





Put another way: you need the import solely for the purpose of the compiler and JVM being able to find the definition of the DataBaseAutoConfiguration class to use in your code. You can't tell Spring Boot to exclude that class if the compiler and JVM don't even know how to load it.

– Mike
Nov 15 '18 at 22:32





Put another way: you need the import solely for the purpose of the compiler and JVM being able to find the definition of the DataBaseAutoConfiguration class to use in your code. You can't tell Spring Boot to exclude that class if the compiler and JVM don't even know how to load it.

– Mike
Nov 15 '18 at 22:32




1




1





Correct: presumably DataBaseAutoConfiguration is marked as @Configuration so without the exclude, Spring would scan it and load any beans and config from it.

– Mike
Nov 15 '18 at 22:33





Correct: presumably DataBaseAutoConfiguration is marked as @Configuration so without the exclude, Spring would scan it and load any beans and config from it.

– Mike
Nov 15 '18 at 22:33



這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini