How to extend spring security config and spring authorisation server in eclipse? - eclipse

I can port spring authorisation server into Eclipse via the gradle project, but I am stumped on how to also add spring security config as a code dependency so that I can update the config classes.
I am unsure how to link the 2 projects as in Eclipse it is using a library classpath built from gradle config.
I have tried adding spring security as a implementation project and adding a projectdir but it fails as it cannot classes and plugins to build the classpath.
Any ideas? Tried contacting the development team but no response so far.
Tried contacting the developers
adding project dependency

Related

Understanding STS: Spring boot application works fine from STS but when gradle is used to build jar, the build fails

My spring boot application works fine when run from Spring Tool Suite. However at the time of project deployment when I use Gradle command to build jar file, I get compile error - with error message saying a specific package is missing.
The root cause was that I had missed to add a specific dependency to build.gradle. After adding the missing dependency the build was successful.
Can someone explain how STS was able to refer to the "missing" dependency and able to run the application successfully in development environment?
Is it that STS and Gradle has two different locations where dependencies are stored?
When using STS (or any other IDE for that matter) and you are manually (or through a wizard) adding jars to the classpath entries those will only be available in your IDE.
What you should be doing is adding additional dependencies to your pom.xml or build.gradle (depending on your tooling), which then in turn should be picked up by your IDE again.
NOTE: Some IDEs will automatically detect additions to the classpath and add them to your build files as well. Not sure if STS (and thus Eclipse) does this.

Why does Eclipse New Maven Project not list Spring Boot Starters?

I have the latest version of Eclipse and am creating a basic Spring Boot Web project.
When I use the New -> ... -> New Maven Project and use the dialog to browse Maven Central for the Spring-Boot-Starter-Web artifact it isn't listed.
Why is Eclipse not listing it?
The configured repository is https://repo1.maven.org/maven2 (Maven Central) which is where Spring-Boot-Starter-Web is meant to reside. (https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web/2.2.4.RELEASE)
I know how to use https://start.spring.io/ to create a spring boot start application so my question is not about how to create one.
What I want to know is what is it about Eclipse, or Maven, that prevents the Spring Boot Starters showing up. I am concerned that there may be plenty of other artefacts that are not visible here and would like to understand the rational for this so I can anticipate what may not be visible.
I appreciate I'm assuming here that a logical reason exists and apologises if it has more to do with how Eclipse feels about things to do with Spring Framework.
You can add in Eclipse from the Help -> Eclipse Marketplace the Spring tools plugin (probably you'll find a newer version of the plugin):
After install it, you'll be able to create a Spring Boot project managing the dependencies at creation time. Select Spring Boot -> Spring Starter Project:
Then you can select which maven dependencies to add:
it lists certain Maven archetype which Spring Boot starters aren't.
It's that simple.
Also, if you have archetypes (e.g. your company makes its own) you can add them to the list of archetypes known to your IDE.

eclipse with new aws java web project, upgrade jar version

I'm not sure if I'm on the right track, but I can't find similar question on google or stackoverflow.
I'm using eclipse (luna), and I have this plugin from amazon, aws toolkit. When I create a project by clicking 'new aws web project', a new project will be created, and inside the aws sdk for java, some of the jar files have a version which is not I want, for example, spring-core-3.0.7.jar.
I tried convert this project to maven project and include dependency with latest spring-webmvc 4.x, but is seems two packages have conflict with each other. ref:
why .NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter
Two Maven Dependency for latest and old version conflicts
Spring MVC - Why the NoSuchMethodError exception when deploying context?
I tried to delete or upgrade the jar from aws sdk for java, but I can't find a way to delete it or upgrade it.
Then, I tried to create a normal java web project, convert to maven project and include the aws-java-sdk-core from maven repository, but after that I can't use the deploy to elastic beanstalk function.
Actually, I just want to create a project which let me use the latest spring framework, and also able to deploy to aws elastic beanstalk.
Follow steps:
create aws java web project
convert to maven project
delete aws java sdk package
add necessary jar using maven pom.xml
upload to aws elastic beanstalk
it works.

Spring installation with Eclipse

I have downloaded and installed Spring STS for Eclipse...
But when I've Created a Spring Project I can't to
import org.springframework.context.ApplicationContext;
So I tried to add library like spring.jar but I couldn't find this jar.(properties-->java build path-->libraries)
What's wrong with this setting? Or my installation is not ended?
Spring STS is only a Eclipse plugin which helps the developer managing spring beans. It is not mandatory for developing a spring-based application.
So your second approach was the right one to add the spring library. You can download spring here: Spring Downloads and then add it as a library to your project.
But serious... I would encourage you to do a tutorial first: http://www.springsource.org/tutorials
Plugins does not includes library of spring.
Plugin is only to manage the reference of configuration in your project build in eclipse.
Libraries are actual jar file which is required at compile as well as run time.
If you skip the plugin installation then your code will work if your configuration is correct
But if you skip spring library installation or download then your code will not compile of run.
Please go through step by step tutorial by following these tutorial
Spring Step By Step Tutorial

GWT + Spring Security = Unable to locate Spring NamespaceHandler

I have a clean GWT application which I want to secure with Spring Security. I have a standard filter configuration in web.xml and a standard form-based security configuration in my Spring context file.
When I build my application as a .war and deploy it to an app server it works as expected, however when I try to run it in the GWT Jetty server within Eclipse I get the dreaded Unable to locate Spring NamespaceHandler exception because of the security namespace.
I know that this is usually due to a missing spring-security-config library, but I am certain that all my requisite Spring Security libraries are on the classpath. Is there something I'm missing about how the GWT Eclipse plugin server handles class loading?
I have tried every combination I can think of to manually add the Spring Security .jars to my project build path, my run configuration path, etc.
It appears that the GWT Eclipse plugin server does not respect the Eclipse project classpath settings. When I manually copy the spring-security .jars into WEB-INF/lib and run a GWT Compile, everything works as expected.