sbp introduce plugin oriented programming to Spring Boot. It is inspired and builds on top of Pf4j project.
2.0
to 2.7
sbp
, but so far it maybe the
best choice to solve application extension problem.sbp-spring-boot-starter
to dependencies.
<dependency>
<groupId>org.laxture</groupId>
<artifactId>sbp-spring-boot-starter</artifactId>
<version>2.7.14</version>
</dependency>
dependencies {
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "org.springframework.boot:spring-boot-starter-aop"
implementation 'org.laxture:sbp-spring-boot-starter:2.7.14'
}
-SNAPSHOT
application.properties
.
spring.sbp.runtimeMode = development
spring.sbp.enabled = true
# remember to add this line in case you are using IDEA
spring.sbp.classes-directories = "out/production/classes, out/production/resources"
Controller
, Service
, Repository
, Model
, etc.plugins
.plugins
folder.plugin.properties
file to the plugin project.
plugin.id=<>
plugin.class=demo.sbp.admin.DemoPlugin
plugin.version=0.0.1
plugin.provider=Your Name
plugin.dependencies=
sbp-core
to dependencies.
<dependency>
<groupId>org.laxture</groupId>
<artifactId>sbp-core</artifactId>
<version>2.7.14</version>
</dependency>
dependencies {
implementation 'org.laxture:sbp-core:2.7.14'
}
public class DemoPlugin extends SpringBootPlugin {
public DemoPlugin(PluginWrapper wrapper) {
super(wrapper);
}
@Override
protected SpringBootstrap createSpringBootstrap() {
return new SpringBootstrap(this, AdminPluginStarter.class);
}
}
Controller
, Service
, Repository
, Model
, etc.Everything is done and now you could start the app project to test the plugin.
SpringApplication
DemoApp
does not have Spring Security configured.DomeSecureApp
include Spring Security, so you need to provide authentication information
when access its rest API.SpringApplication
could be run standalone./*
* Copyright (C) 2019-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/