Code Monkey home page Code Monkey logo

bring's Introduction

Maven Central

Bring Framework Documentation

  • Overview History, Design Philosophy, Feedback, Getting Started.
  • Core IoC Container, Resources, Type Conversion, Scheduling.
  • Web Bring Web.

Getting Started

If you're new to Bring, consider initiating your experience with a Bring playground application repo with a variety of examples of how to use it. Bring Boot offers a swift and opinionated method to develop a Bring-based application ready for play. Leveraging the Bring Framework, it prioritizes conventions over extensive configurations, aiming to accelerate your setup process and swiftly get you up and running.

Installation

  • Open your Maven Project:

Open the Maven project where you want to add the Bring framework dependencies.

  • Edit pom.xml:

Locate the pom.xml file in your project.

  • Add Repository Configuration:

Inside the section of your pom.xml, add the following repository configuration if you want to try latest Snapshot version of Bring project:

<repositories>
		<repository>
			<releases>
				<enabled>false</enabled>
				<updatePolicy>always</updatePolicy>
				<checksumPolicy>warn</checksumPolicy>
			</releases>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
				<checksumPolicy>fail</checksumPolicy>
			</snapshots>
			<name>Nexus Snapshots</name>
			<id>snapshots-repo</id>
			<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
			<layout>default</layout>
		</repository>
</repositories>

This configuration informs Maven about the repository location where it can find the Bring framework artifacts.

  • Include Dependency:

Within the section of your pom.xml, add the Bring framework dependency (You will have web & core):

<dependencies>
    <dependency>
        <groupId>io.github.blyznytsiaorg.bring.web</groupId>
        <artifactId>web</artifactId>
        <version>2.0.0-SNAPSHOT</version>
    </dependency>
</dependencies>

if you would like to work with core only then you need to add core dependency

<dependencies>
    <dependency>
        <groupId>io.github.blyznytsiaorg.bring.core</groupId>
        <artifactId>core</artifactId>
        <version>2.0.0-SNAPSHOT</version>
    </dependency>
</dependencies>

Ensure the groupId, artifactId, and version values are accurate for the Bring framework you intend to use.

To obtain the release version, simply review the version we've released; there's no need for the repository section:

<dependencies>
    <dependency>
        <groupId>io.github.blyznytsiaorg.bring.web</groupId>
        <artifactId>web</artifactId>
        <version>1.0.0</version> <!-- or latest -->
    </dependency>
</dependencies>

if you would like to work with core only then you need to add core dependency

<dependencies>
    <dependency>
        <groupId>io.github.blyznytsiaorg.bring.core</groupId>
        <artifactId>core</artifactId>
        <version>1.0.0</version> <!-- or latest -->
    </dependency>
</dependencies>

  • Save Changes:

Save the pom.xml file after adding the repository and dependency configurations.

  • Build the Project:

Run a Maven build for your project. You can do this through your IDE or by using the command line:

mvn clean install

Maven will download the required dependencies from the specified repository and add them to your project's classpath.

  • Verify Dependency Addition:

Check the build logs for any errors or warnings related to dependency resolution. If the build completes successfully, it indicates that the Bring framework dependencies are successfully added to your project.

Feedback and Contributions

If you suspect an issue within the Bring Framework or wish to propose a new feature, kindly utilize GitHub Issues for reporting problems or submitting feature suggestions If you have a solution in mind or a suggested fix, you can submit a pull request on Github. In addition, please read and configure you idea to follow our Setup Code Style Guidelines

bring's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bring's Issues

Configure logging in core

add logging dependencies

  • slf4j-api, logback
    add logback.xml and logback-test.xml

added a few appenders:

  • file
  • async
  • console

Error when you start tomcat (ClassNotFoundException: org.apache.jasper.servlet.JspServlet)

Step to reproduce:

  • start BringStarterApplication via a run method
  • monitor the logs
    actual result:
  • The application started but we had some error
    java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1437) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1245) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:491) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:473) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:143) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:805) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4601) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4894) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:846) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:241) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:918) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) at org.apache.catalina.startup.Tomcat.start(Tomcat.java:485) at com.bobocode.bring.web.embeddedTomcat.TomcatWebServer.initialize(TomcatWebServer.java:32) at com.bobocode.bring.web.embeddedTomcat.TomcatWebServer.<init>(TomcatWebServer.java:21) at com.bobocode.bring.web.embeddedTomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:40) at com.bobocode.bring.web.BringStarterApplication.run(BringStarterApplication.java:17) at com.bobocode.bringplayground.BringPlaygroundApplication.main(BringPlaygroundApplication.java:10)
    expected result:
  • The application started no errors

Add DI arch diagram for readme.md

DI flow diagram

Image

  1. The BringApplication provides a simple entry point to initialize and run a BringApplicationContext.
    It allows the user to create and configure a BringApplicationContext either by specifying a base package for component scanning or by providing a class that contains configuration information.

  2. The ClassPathScannerFactory is responsible for creating a set of class path scanners, each designed to scan the classpath for specific types of annotated classes relevant to the Bring application. It initializes scanners for components, services, and configuration classes etc.

  3. The BeanPostProcessorDefinitionFactory is responsible for creating and managing a list of BeanFactoryPostProcessor instances. It initializes the list with default post-processors, such as the ConfigurationClassPostProcessor etc. In this step we create Bean definitions for classes annotated with annotations from ClassPathScanner

  4. The BeanPostProcessorFactory is responsible for creating and managing a list BeanPostProcessor instances. It initializes the list with default post-processors such as the ScheduleBeanPostProcessor and add addition loginc to them.

Add PreDestroy annotation and implement logic that handle it

Update BringBeanFactory with new method close

Add implementation of the method in class AnnotationBringBeanRegistry you should go throw all singletonObjects and check if we have a method with PreDestroy if yes call it.

As for the web we need to add this logic to Web listener onDestroy it will called when Tomcat stops. TomcatServletWebServerFactory -> context.addLifecycleListener();

add javadoc
add test
add MD

Should throw exception when we have two dependencies for one interface

If we have one interface and two dependencies and the inject param does not match any dependency. We should have an exception.

No qualifying bean of type 'interface com.levik.bringplayground.feature.di.Drink' available: expected single matching bean but found 2: [Latte, Espresso]

Properties injection (via @Value)

  • Value injection via field, set, constructor
  • application.properties - default one, can be overridden when you set profile, for instance, qa and you have application-qa.properties. That the value that overridden will be more priority.

Property injection field that not defined in application.properties

  • If a client forgets to include a value in the application properties file but utilizes the @value annotation, it's crucial to handle this scenario by throwing an exception indicating the inability to resolve the value. This handling should encompass the constructor, field, and setter methods.

Add the possibility to override Profile annotation via -Dbring.active.profile=dev

add tests to handle these cases BringValueInjectionTest & update Value.md with negative cases.

This is one of the negative examples that need to be handle

@Disabled("Need to throw exception when we cannot find value and do the same for constructor, setter and field injection")
@DisplayName("Should found profile bean and read application properties and do field injection but value not found")
@Test
void shouldFoundProfileBeanAndReadApplicationPropertiesAndSetNullValueToFieldInjectionIfNotFound() {
    //when
    var bringApplicationContext = BringApplication.run(TEST_DATA_NEGATIVE_PACKAGE + ".fieldproperties");
    NotFoundValue notFoundValue = bringApplicationContext.getBean(NotFoundValue.class);
}

Notes:

  • PropertyFieldValueTypeInjector, PropertyParameterValueTypeInjector
  • ValuePropertiesPostProcessor

Add PostConstruct annotation and BPP

Create BPP that implements BeanPostProcessor and add logic to handle PostConstract annotation.

Add java doc
Add MD file with feature
Add tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.